[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" <costello@mitre.org>, xml-dev@lists.xml.org
- Date: Thu, 24 May 2001 15:39:21 +0200
Hi there,
"Roger L. Costello" wrote:
> [1] 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
example:
<!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...)
Cheers Patrick
begin:vcard
n:Ohl;Patrick
tel;cell:+49-1708607430
tel;home:+49-89-38859084
tel;work:+49-89-358680-45
x-mozilla-html:FALSE
url:http://www.jNerd.de
adr:;;Ainmillerstr. 6;Munich;;80801;Germany
version:2.1
email;internet:Patrick.Ohl@o-h-l.de
fn:Patrick Ohl
end:vcard