Serialize document with internal DTD using DOMWriter ( Xerces )

Serialize document with internal DTD using DOMWriter ( Xerces )

Post by Simo » Fri, 04 Jul 2003 16:48:59



Hi,

I'm trying to serialize an XML document to a file using XERCES-C++
2.1.0 . The Document contains an internal DTD.

The DTD contains some elements with default values like the following
snippet:

<!ELEMENT SFLOPTRECPATTERN (#PCDATA)>
<!ATTLIST SFLOPTRECPATTERN
        string CDATA "&quot;&quot; &quot;/&quot; &quot;-&quot; 0 9"

...and the document contains some elements like this one:

<SFLOPTRECPATTERN string="&quot;&quot; &quot;/&quot; &quot;-&quot; 0
9"/>

My problem is:

when I parse the file, and later try to serialize it with DOMWriter's
writeToString-method, it breaks my internal DTD.
The above snippet will now look like this ( later resulting in a
parser error ),

<!ELEMENT SFLOPTRECPATTERN (#PCDATA)>
<!ATTLIST SFLOPTRECPATTERN
        string CDATA """ "/" "-" 0 9"

while the corresponding element still remains correct:

<SFLOPTRECPATTERN string="&quot;&quot; &quot;/&quot; &quot;-&quot; 0
9"/>

Can anyone tell me, how I could prevent DOMWriter from changing my
&quot; to " in a DTD?

Regards,

Simon