From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Thu Jan 04 2001 - 10:35:21 EST
On Mon, Dec 04, 2000 at 07:14:25PM -0500, Michael Mealling wrote:
> That's cool. I got all of this figured out but now I think
> there might be a bug or else a problem in the reading of the XML spec.
> I have a DTD that has this in it:
>
> <!ELEMENT results (status? |
> ( service+,
> ( status | resourcedescriptor | referral )*
> )*
> )>
>
>
> and when I give it this:
>
> <!DOCTYPE cnrp PUBLIC "-//IETF//DTD CNRP 1.0//EN" "http://www.ietf.org/cnrp.dtd">
> <cnrp>
> <results>
> <service id="service1" ttl="10000">
> <serviceuri>http://cnrp.networksolutions.com>
> </service>
> <resourcedescriptor>
> <commonname>BAILEY BEAR</commonname>
> <id>8000112</id>
> <resourceuri>http://bailey.dscga.com/>
> <serviceref ref="service1"/>
> <description>Michael and Kathy's Golden Retriever</description>
> </resourcedescriptor>
> </results>
> </cnrp>
>
>
> the parser barfs these errors:
> Element results content doesn't follow the Dtd
> Expecting (status? | (service+ , (status | resourcedescriptor | referral)*)*),
> got (service resourcedescriptor )
>
> Based on other parsers and my reading of the XML spec, that DTD
> should allow that xml. Any clues as to why libxml tags that as an error?
Well i had a look at this.
The problem is more complex than a simple libxml bug, the problem
is that the content model of your DTD is not deterministic.
basically it's of the form
(a? | b)
The content model of this element doesn't match the a term but due to
the ? the first term of the or expression matches, and the b expression isn't
examined, a simple tree descent is not sufficient to remove the ambiguity
My feeling is that your DtD is slightly broken w.r.t. the XML spec,
check the appendix on deterministic content models:
http://www.w3.org/TR/REC-xml#determinism
I don't have an absolute fix right now for this, I need to examine the
issue further, one trick would be to swap the two values of the top or
expression of the result element DtD description in the meantime.
Daniel
-- Daniel Veillard | Red Hat Network http://redhat.com/products/network/ daniel@veillard.com | libxml Gnome XML toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ ---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net
This archive was generated by hypermail 2b29 : Thu Jan 04 2001 - 11:43:34 EST