[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: basic XML questions on: non-determism
- From: Patrick Ohl <Patrick.Ohl@o-h-l.de>
- To: "Roger L. Costello" <email@example.com>, firstname.lastname@example.org
- Date: Thu, 24 May 2001 15:39:21 +0200
"Roger L. Costello" wrote:
>  It was my understanding that the following is not allowed:
> <!ELEMENT signature (name | (name, date))>
> because it would require an XML Parser to "look-ahead" when it
> encountered the <name> element to determine which choice was taken.
> I have actually tested this example with xerces and XML Spy. Both
> parsers accept this. Are they erroneously accepting this? Can someone
> please clarify what it means that non-deterministic content models are
> not allowed in XML?
Appendix E in the XML Spec ( http://www.w3.org/TR/REC-xml#determinism )
is Non-Normative. The non-determinism is mostly for SGML compatibility.
So it more a 'should' than a 'must'. In most cases non-deterministic
expressions can easily be translated to detemistic ones. so in your
<!ELEMENT signature (name, (date)?)>
A good DTD should do it this way.
(I am currently building a XML to Java Data-Binding tool. And it
happened to be a problem to translate ambiguous content models. But
there are algorithms to transform them to unambiguous. Ugh! Just don't
want to implement them...)