I was probably being over-brief in my use of 'syntactic'. I meant that DTDs
only validate the syntactic structure of the document. Obviously we shall
insist on well-formed XML. Assume I have a content model:
<!ELEMENT Molecule (Atom*, Bond*)>
And a chemist now wishes to include additional information (electron count)
in the molecule, e.g.
<Molecule name="H2+">
<Electron>1</Electron>
<Atom>...</Atom>
<Atom>...</Atom>
<Bond>...</Bond>
</Molecule>
This breaks the content model. I have the following alternatives:
- tell the author it's not allowed. Kills the whole idea of XML immediately.
- produce and circulate a new DTD. Effectively impossible. It would be
redefined so often as to cause chaos.
- use ANY for all my content models (effectively scrapping content
validation)
use the DTD for a structural guide but not insist on validation. The DTD
can still be used to help drive authoring tools, support software, etc. So
my software tends to look like:
Molecule.java:
public void process() {
Vector atomVector = this.getChildrenWithElementName(LOCAL, "Atom");
Vector bondVector = this.getChildrenWithElementName(LOCAL, "Bond");
}
Note that this allows my to look for what I know to be there while
accepting that other stuff isn't.
For semantic validation I am far more concerned that an atom's atomic
number is between 0 an 100 and is not "-23.7" or "Mickey Mouse".
As you will agree, this is discipline-dependent but I expect to appeal
beyond chemistry.
HTH
P.
>
Peter Murray-Rust, Director Virtual School of Molecular Sciences, domestic
net connection
VSMS http://www.nottingham.ac.uk/vsms, Virtual Hyperglossary
http://www.venus.co.uk/vhg