Re: [xml] Conditional Sections and the X3D DTD

Date view Thread view Subject view Author view

From: Jonathan P Springer (jonathan.springer2@gte.net)
Date: Sun Nov 12 2000 - 16:16:54 EST


On Sun, 12 Nov 2000 13:04:40 Daniel Veillard wrote:
>
> On Sun, Nov 12, 2000 at 12:01:40PM -0500, Jonathan P Springer wrote:
> >
> >
> > I've been fiddling with using libxml to parse Web3D X3D files. I'd had
no
> > problems parsing them until I turned on validation, at which point all
heck
> > broke loose, primarily around conditional sections.
> >
> > Basically, the X3D DTD (see http://www.web3d.org/TaskGroups/x3d/translation/x3d-compromise.dtd)
> > uses several parsed entities to define which sections of the X3D
> > specification
> > should be included and which should be excluded. The idea is that the
> > DOCTYPE
> > in the X3D file can be used to switch on and off certain features in
the
> > specification.
>
> Okay the Docbook DTD uses those heavilly too.
>
> > OK, so once Daniel put in the Conditional Section coding (was that
version
> > 2.2.3?), I thought I'd be home free. Think again...
>
> Did you try with 2.2.7 ?

Sorry, no. I made it to 2.2.6 still with the same warning. I'm using
Debian Linux, so I'm usually .1 release behind. I haven't tried compiling
from your releases yet, but I'll give it a stab later tonight...

> > Running my test file (see http://members.theglobe.com/springjp/try2.txt)
> > yielded the following warning:
>
> Hum I was really unable to extract anything useful form this URL,
> Could you send it to me ?

It's a short file. I'll attach to this e-mail and try to find a better
site
to drop it onto. I've put Daniel as a seperate 'To:' in case the listserv
doesn't pass through the file.

>
> > --> warning: PEReference: %ChildrenNodes; not found
> > --> <!ENTITY % SceneNodes " ( %ChildrenNodes; |
%WildcardNodes; )*, ROUTE* "
> >
> > I did a little investigation in the DTD file and found out that what
was
> > happening was this:
> >
> > --> <!ENTITY % CoreProfile "IGNORE">
> > ...
> > --> <![%CoreProfile;[
> > --> <!ENTITY % ChildrenNodes " %BehaviorLeafNodes; |
%BindableNodes; | %GroupingNodes; | %SceneLeafNodes; " >
> > --> <!ENTITY % SceneNodes " ( %ChildrenNodes; |
%WildcardNodes; )*, ROUTE* " >
> > --> ]]>
>
> Okay,
>
> > A bit of nosing around in parser.c found that although the results of
parsing
> > weren't being applied for the IGNOREd section, the Parsed Entities (in
this
> > case ChildrenNodes) were still being passed through the parser.
>
> yes
>
> > Next stop, the Gospel according to XML 1.0 Second Edition. The grammar
> > spec for an IGNOREd section is:
> >
> > --> [61] conditionalSect ::= includeSect | ignoreSect
> > --> [62] includeSect ::= '<![' S? 'INCLUDE' S? '[' extSubsetDecl ']]>'
>
> > --> [63] ignoreSect ::= '<![' S? 'IGNORE' S? '[' ignoreSectContents*
> ']]>'
> > --> [64] ignoreSectContents ::= Ignore ('<![' ignoreSectContents ']]>'
> > Ignore)*
> > --> [65] Ignore ::= Char* - (Char* ('<![' | ']]>') Char*)
> >
> > Or, in English, take anything that comes in the section, so long as the
> > '<!['s and ']]>'s balance.
>
> As you can see at
> http://www.w3.org/TR/2000/REC-xml-20001006-review.html#sec-condition-sect
>
> The second edition wording revamped the explanations a bit.
>
> > If you've had the spare time to stick with me through this, I've
> > attached my
> > recommended patches (as of v2.2.4) below. In essence, I've added a
> > state for
> > IGNORE sections and changed the code in xmlParseConditionalSections to
> > count opens
> > and closes. I hope that will be enough; additional testing or
> > alternative approaches would be welcome.
>
> Sure I will look at it (one I get a test case this will help too :-).
> Adding a new state might be a bit heavy, I would like to be sure it's
> really the right way to do it. It looks like it is but :-)

I thought it was overkill, too, but it was the only sensible way I could
see to keep NEXT from choking on all the '%'s flying around in the IGNOREd
sections. I don't use the SAX chunk of the code much either, so I was
working by guess and by golly (by duplicating the COMMENT logic).

> I just tried with a fake document:
>
> --------------------------
> ~/XML -> ./xmllint --valid try.xml
> http://www.web3d.org/TaskGroups/x3d/translation/x3d-compromise.dtd:322:
> warning: PEReference: %ChildrenNodes; not found
> <!ENTITY % SceneNodes " ( %ChildrenNodes; | %WildcardNodes;
> )*, ROUTE* "
>
> ^http://www.web3d.org/TaskGroups/x3d/translation/x3d-compromise.dtd:394:
> warning: failed to load external entity
> "file://localhost/C%3A/www.web3D.org/TaskGroups/x3d/translation/DisJavaVrml.dtd"
> %DisJavaVrmlDTD;
> --------------------------
> Even if it should not be loaded, having "file://localhost/C:/"
> referenced
> from a published Dtd sounds lame anyway :-\
>
> Daniel

I'd forgotten about the external file references. I had IGNOREd them.
I'll lodge a complaint with the X3D folks independantly; I agree with
your lameness assessment there.

I admit, this does all qualify as cosmetic; I just don't like to
write code that has to run '2>/dev/null'.

-jonathan


----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sun Nov 12 2000 - 16:43:27 EST