On 2015-09-23 13:11, Simon St.Laurent wrote:
> Actually, on further reflection, I remembered why I quit using Java
> to process XML.
>
> Joshua Bloch's Effective Java gave really similar advice about
> programming Java - enumerations over strings, strict structures over
> variable structures, and so on. About halfway through the book I
> realized I was carving myself out a personal exception to all of those
> things, so sat down to look at my code.
For some environments and some sorts of "documents" this makes some
sense, but it's a world in which the programmer is in control of the
data; it's not the world of human-readable documents and text markup.
When I'm transcribing an 18th century glossary, and I've made a DTD to
help me do the editing, if I get to a place where (a real example) the
editor included a letter he'd received about an entry several pages
earlier, and the letter contains a poem, it's my DTD that's wrong; I
modify it to allow a poem inside a glossary. The document is
authoritative in that context, not my DTD.
If I'm working on an ATA aeroplane Flight Information Manual, and I get
to the part about what the flight crew should do if the toilet is out of
order, it's not appropriate for me to insert a poem; the DTD doesn't
allow it and neither does the ATA, and for good reason (although perhaps
a little more whimsy would greatly alleviate the maintenance workers!).
The ATA is authoratative, and their DTDs and guidelines reflect that.
If I'm using XML for a computer-to-computer communication such as a Web
service API or an internal configuration file, and I'm the programmer or
chief developer, I have authority over the format and I can decide that
there are no variable strings in my API. But it'd be pretty weird if
there's a database of parts that can be ordered, not to include their
descriptions, or not to include the name and address of the customer,
and at that point you're back in the world of variable structures.
Roger - don't let programming ideologies blind you to the actual
problems.
Liam
--
Liam Quin, W3C
XML Activity Lead;
Digital publishing; HTML Accessibility