why is entity ref expanded in the internal subset (and related questions)?...
Jacob Kjome <[email protected]> Sat, 08 Apr 2006 00:32:28 -0500
| Newsgroups | gmane.text.xml.general |
|---|---|
| Message-ID | <[email protected]> |
I'm having a problem with the following... <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE vxml SYSTEM "voicexml1-0.dtd" [ <!ENTITY % BigEntity SYSTEM "BigEntity.ent"> %BigEntity; ]> <vxml version="1.0"> <form id="init"> <block> &BigEntity; </block> </form> </vxml> BigEntity.ent looks something like this... <?xml version="1.0" encoding="UTF-8"?> <!ENTITY BigEntity ' <prompt>another prompt</prompt> <prompt>another prompt</prompt> <prompt>another prompt</prompt> <prompt>another prompt</prompt> <prompt>another prompt</prompt> <prompt>another prompt</prompt> <prompt>another prompt</prompt> '> When internalEntityDecl(String name, XMLString text, XMLString nonNormalizedText, Augmentations augs) gets called, both the text.toString() and nonNormalizedText.toString() contain the fully expanded contents of the entity (a bunch of <prompt>another prompt</prompt> entries). After I build this into a DOM and serialize it, it looks like... <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE vxml SYSTEM "voicexml1-0.dtd" [ <!ENTITY %BigEntity SYSTEM "BigEntity.ent"> <!ENTITY BigEntity " <prompt>another prompt</prompt> <prompt>another prompt</prompt> <prompt>another prompt</prompt> <prompt>another prompt</prompt> <prompt>another prompt</prompt> <prompt>another prompt</prompt> <prompt>another prompt</prompt> "> ]> <vxml version="1.0"><form id="init"><block>&BigEntity;</block></form></vxml> Why are the contents expanded? Why not just give me "%BigEntity;" from the original document? Is there any recourse? A second problem is that reparsing this file gives me the following parsing error... test9.gen.xml:4: Error: White space is required after "<!ENTITY" in the entity declaration. The parse error seems to be with the external entity declaration "%BigEntity". If I change that to "% BigEntity", the parse error goes away. But, the "name" parameter passed to me in the externalEntityDecl() method is exactly "%BigEntity". If the parser knows it can't deal with that, why doesn't it pass me "% BigEntity"? Seems odd that I'd be forced to split the "%" apart from the rest of the entiy name manually. thanks, Jake