xerces-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mini thomas <mini_mol_tho...@yahoo.com>
Subject DOMLSSerializer converts white space characters in attributes to xml entities
Date Thu, 30 Jul 2009 15:24:20 GMT
I am using xerces 3.0.1 and doing the following

1) Parse a string
2)Set an attribute "newattr" on the root node. The attribute value is 
char *temp = "\n Hello \t\t testing"
3) converting the parsed data back to xml
static const XMLCh gLS[] = { chLatin_L,  chLatin_S,  chNull };
DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(gLS);
DOMLSSerializer*  myWriter = (impl)->createLSSerializer();
DOMConfiguration* dc = myWriter->getDomConfig();
dc->setParameter( XMLUni::fgDOMWRTDiscardDefaultContent,true);
// serialize the DOMNode to a UTF-16 string
XMLCh* theXMLString_Unicode = myWriter->writeToString(toWrite.GetDOMNodePtr());

4) Convert theXMLString_Unicode  to char* and print using cout.
 I got the attribute printed this way.
newattr="&#xA; Hello &#x9;&#x9; testing"
Is there any way to get the attribute printed as newattr="
 Hello  testing"

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message