I have a  source like this, which I read and parse :

<?xml version="1.0"  standalone="no" ?>
<Messaggio>
...........
<Test1> start  &lt; &gt;  &amp; &#x28;  &#xA5; &#x29;  end  </Test1>
</Messaggio>

If I write using DOMWriter and XMLFormatTarget

   dom_wr = impl->createDOMWriter();
   XMLFormatTarget *myFormTarget;
   myFormTarget = new StdOutFormatTarget();
   dom_wr->writeNode(myFormTarget, *pDoc);
   delete myFormTarget;

I got and answer like this:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Messaggio>
..........
<Test1> start  &lt; &gt;  &amp; (  ¥ )  end  </Test1>
</Messaggio>

while if I use the function dom_wr->writeToString ( see belowe ) I get an
empty string

   chXml     = dom_wr->writeToString( *pDoc );
   delete dom_wr;
   delete errHandlerDomWriter;

   sXml = XMLString::transcode( chXml );
   sres = string( sXml );
   XMLString::release( &sXml );

sres is EMPTY

Do you known any idea about that ?
I'm using xerces 2.4 on redhat 7.3





DOCUMENT:

-----Messaggio originale-----
Da: AESYS S.p.A. [Enzo Arlati] [mailto:[EMAIL PROTECTED]
Inviato: mercoledì 14 settembre 2005 14.24
A: c-dev@xerces.apache.org
Oggetto: using non standard character with zerces



I' m using a code like the one show belowe to build a DOM document.

       DOMElement * pTestRef;
       string stmp;
       stmp = string( "this is a test: <> & &#165; " );
       pTestRef = pDoc->createElement( X("TEST_REFERENCE_1") );
       dtxt                  = pDoc->createTextNode( X( stmp.c_str()));
       pRoot->appendChild( pTestRef );
       pTestRef->appendChild( dtxt );

The output I get is show belowe, where entities >,> and & a re corretly
translated.

<?xml version="1.0" encoding="UTF-16" standalone="no" ?>
<Messaggio>
......
<TEST_REFERENCE_1>this is a test: &lt;&gt; &amp; &amp;#165;
</TEST_REFERENCE_1>
</Messaggio>

What I can't do is to pass other entities in hex or decimal notation like
&#165 for the euro character, because the first & which is part of the whole
enitiy is translated separately.
How is possible to tell to DOMWriter to leave as is ( without translate teh
& char ) entities composed by more characters ( like &#xA5;  , &#165; or
&lt; )

Regards,
Enzo Arlati
[EMAIL PROTECTED]



---------------------------------------------------------------------
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