Re: Namespaces and XML validation

Peter Murray-Rust (peter@ursus.demon.co.uk)
Tue, 11 Aug 1998 06:57:56


At 15:13 10/08/98 -0700, Lisa Rein wrote:
>peter murray rust wrote:
>
>>
>> As I have often
>> (probably boringly) said, I think my community is far more interested in
>> semantic than syntactic validity. (Actually they probably don't care about
>> either much...)
>
>
>How can you possibly have one without the other? If your syntax is
>bogus -- you won't get far with semantics. How can you?

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