Sjoerd Mullender
Usenet Archive
- Joined
- Feb 17, 2004
- Messages
- 10
- Reaction score
- 0
I am trying to create a DTD where some attributes are to have a default value of "100%". The DTD is modularized similarly to the XHTML DTD modularization, so that means I have parsed entities that reference other parsed entities in external subsets.
The problem I'm facing is that the validating parser that I wrote myself accepts my DTD, but libxml2, Xerces and PyXML don't, and I don't know how I can fix the DTD so that all parsers are happy, or indeed whether there is a bug in either my own parser or in the others.
Does anybody have any ideas?
Here is a small example:
File x.xml:
<?xml version="1.0"?>
<!DOCTYPE test PUBLIC "xyzzy" "x.dtd">
<test/>
File x.dtd:
<!ENTITY % test.x.module PUBLIC "plugh" "x.mod">
%test.x.module;
File x.mod:
<!ENTITY % test.test.qname "test">
<!ENTITY % level1 "
attr CDATA '100%'
">
<!ENTITY % level2 "
%level1;
">
<!ENTITY % test.test.content "EMPTY">
<!ELEMENT %test.test.qname; %test.test.content;>
<!ATTLIST %test.test.qname; %level2;>
I can change the value to '%', but then I still get into trouble. My DTD has more levels of indirection than this example: there is effectively also an entity
<!ENTITY % level3 "
%level2;
">
and the ATTLIST refers to this level3 entity. The parsers complain again about the DTD. If I then change the value to &#37; two of the three accept the document, but the third parser (PyXML) still complains.
Note that & is "&" and % is "%".
The problem I'm facing is that the validating parser that I wrote myself accepts my DTD, but libxml2, Xerces and PyXML don't, and I don't know how I can fix the DTD so that all parsers are happy, or indeed whether there is a bug in either my own parser or in the others.
Does anybody have any ideas?
Here is a small example:
File x.xml:
<?xml version="1.0"?>
<!DOCTYPE test PUBLIC "xyzzy" "x.dtd">
<test/>
File x.dtd:
<!ENTITY % test.x.module PUBLIC "plugh" "x.mod">
%test.x.module;
File x.mod:
<!ENTITY % test.test.qname "test">
<!ENTITY % level1 "
attr CDATA '100%'
">
<!ENTITY % level2 "
%level1;
">
<!ENTITY % test.test.content "EMPTY">
<!ELEMENT %test.test.qname; %test.test.content;>
<!ATTLIST %test.test.qname; %level2;>
I can change the value to '%', but then I still get into trouble. My DTD has more levels of indirection than this example: there is effectively also an entity
<!ENTITY % level3 "
%level2;
">
and the ATTLIST refers to this level3 entity. The parsers complain again about the DTD. If I then change the value to &#37; two of the three accept the document, but the third parser (PyXML) still complains.
Note that & is "&" and % is "%".