|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] DTD parameter entities
I'm implementing parameter entity support for my XML parser (well I guess it can be truly called XML parser when I've finished implementing this and some other DTD processing parts). I think I understand what the XML 1.0 spec and 4.4 XML Processor Treatment of Entities and References says about parameter entities - 4.4.5 Included in Literal etc. is easy to implement of course and 4.4.8 Included as PE seems quite clear; it says that parameter entity references can occur anywhere in DTD but the fact that expansion will insert space (#x20) to the start and to the end of the expanded value places some limitations for construct like <!ENTITY % ENT "<!ENT"> <!ENTITY % ITY "ITY"> %ENT;%ITY; blaah "value"> <!-- will not work because it will expand to <!ENT ITY --> I used the following petest.dtd for testing how various parsers work: (PE references %ELEMNAME;%ATTNAME; are contiguous on purpose - there'll be space between them when they're expanded) <!ENTITY % ATTLIST "<!ATTLIST "> <!ENTITY % CLOSE ">"> <!ENTITY % ELEMNAME "doc"> <!ENTITY % ATTNAME "att"> %ATTLIST; %ELEMNAME;%ATTNAME; CDATA #FIXED "value"%CLOSE; the petest.xml doc was simple: <!DOCTYPE doc SYSTEM "petest.dtd"> <doc/> results (validation was off): - RXP 1.4.0pre10: ok - Expat 1.9.6: ok - Xerces-J 2.6.2: [Fatal Error] petest.dtd:8:10: The replacement text of parameter entity "%ATTLIS T" must include properly nested declarations when the entity reference is used a s a complete declaration. Works fine if %ATTLIST; reference is replaced with <!ATTLIST i.e. <!ATTLIST %ELEMNAME;%ATTNAME; CDATA #FIXED "value"%CLOSE; - MSXML4 (version ?): The replacement text for a parameter entity must be properly nested with parenthesized groups. Error processing resource 'petest.dtd'. Line 6, Position 10 doesn't even work if %ATTLIST; is replaced - will trigger error in %CLOSE; this works: <!ATTLIST %ELEMNAME;%ATTNAME; CDATA #FIXED "value"> Is there something I'm missing? Implementing parameter entity support seems quite trivial (common design stage optimism perhaps ;-) ) but seeing how various parsers react I'm not quite sure if it'll be trivial at all. with respect, Toni Uusitalo
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








