Hi Enzo,
XML requires that ' and " should only be escaped when used inside attribute values (and even in that case, only the one that has been actually used to delimit the attribute value).

Alberto

At 14.00 20/09/2005 +0200, AESYS S.p.A. [Enzo Arlati] wrote:

I build a DOM document and inside a Node I put some string with the standard
entities ( ie. & < > ' and " ).
The first 3 entities are converted in their equivalent entity reference
 ie. &amp; &lt; &gt; )
while the last 2 are not converted ( as show in the example belowe.
What can I do in order to tell the xerces to replace it with their enity
ref.
Please , if possible, send me an example.

    DOMImplementation * impl =
DOMImplementationRegistry::getDOMImplementation( X("LS") );

    if( impl != NULL )
    {
       DOMDocument * pDoc = impl->createDocument( 0, X("Messaggio"), 0 );
       pDoc->setEncoding( X("UTF-16") );
       DOMElement * pRoot = pDoc->getDocumentElement();
       DOMElement * pTest = pDoc->createElement( X("TEST2") );
       pRoot->appendChild( pTest );
       stmp = " std_entities: & < > \" ' ";
       dtxt = pDoc->createTextNode( X( stmp.c_str()));
       pTest->appendChild( dtxt );
       .............
    }

DOCUMENT: <?xml version="1.0" encoding="UTF-16" standalone="no" ?>
<Messaggio><TEST2> std_entities: &amp; &lt; &gt; " ' </TEST2></Messaggio>

Regards, Enzo


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to