Re: [xml] Conditional Sections and the X3D DTD

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Sun Nov 12 2000 - 13:04:40 EST


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 ?

> 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 ?

> --> 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 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

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | libxml Gnome XML toolkit
Tel : +33 476 615 257  | 655, avenue de l'Europe | http://xmlsoft.org/
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Rpmfind search site
 http://www.w3.org/People/all#veillard%40w3.org  | 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


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sun Nov 12 2000 - 13:45:23 EST