Hello list!
i´ve a problem with the Xerces. How can i write my DOM out to a string
includes with the xml declaration in the art:
<?xml version="1.0" encoding="ISO-8859-1"?>
I have wrote the following codesnipped:
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(
X("LS") );
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* doc = impl->createDocument();
doc->setEncoding( X("UTF-8") );
doc->setVersion( X("1.0") );
DOMElement* xml_root_node = doc->createElement( X("ERROR") );
doc->appendChild( xml_root_node );
// Das XML-Dokument in einen String schreiben
DOMWriter* writer =
static_cast<DOMImplementationLS*>(impl)->createDOMWriter( );
// Einen Fehler-Handler registrieren
DOMErrorHandler* errHandler = (DOMErrorHandler*) new HandlerBase();
writer->setErrorHandler( errHandler );
const XMLCh* xmlch_xml_doc = writer->writeToString( *xml_root_node );
const char* str_xml_doc = XMLString::transcode( xmlch_xml_doc );
XMLString::release( (XMLCh**)&xmlch_xml_doc );
The only output is "<ERROR/>" without the xml declaration. What´s wrong? What
can i do?
Greetings
Sascha
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|