It sounds like you want to import nodes from one document into another. You can then serialize the containing document. See DOMDocument::importNode().
-----Original Message----- From: jerome.mariette [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 10, 2007 4:46 PM To: [email protected] Subject: Write/read XML Hi everybody, I'm trying to write an XML file that I previously read (it's in order to include small metadata xml file into a bigger one). But I can't figure out how to add a tree to an already existed tree. here is my code const char* gXmlFile = "myXML.xml"; const XMLCh* gEncodingName = 0; const XMLFormatter* gFormatter = 0; // // Create our parser, then attach an error handler to the parser. // The parser will call back to methods of the ErrorHandler if it // discovers errors during the course of parsing the XML document. // XercesDOMParser *parser = new XercesDOMParser; parser->setValidationScheme(XercesDOMParser::Val_Auto); parser->setDoNamespaces(false); parser->setDoSchema(false); parser->setValidationSchemaFullChecking(false); parser->setCreateEntityReferenceNodes(false); // // Parse the XML file, catching any XML exceptions that might propogate // out of it. // bool errorsOccured = false; try { parser->parse(gXmlFile); int errorCount = parser->getErrorCount(); if (errorCount > 0) errorsOccured = true; } catch (const XMLException& e) { std::cerr << "An error occured during parsing\n Message: " << e.getMessage() << std::endl; errorsOccured = true; } catch (const DOMException& e) { std::cerr << "A DOM error occured during parsing\n DOMException code: " << e.code << std::endl; errorsOccured = true; } catch (...) { std::cerr << "An error occured during parsing\n " << std::endl; errorsOccured = true; } // If the parse was successful, output the document data from the DOM tree if (!errorsOccured ) ///&& !errReporter->getSawErrors()) { DOMNode* metadata = parser->getDocument(); itsStreamWriter->writeNode(itsXMLFileFormatTarget, *metadata); } this code compile fine, sounds like the reading is ok, but when the Node is not written. What am I doing wrong ?? thx -- View this message in context: http://www.nabble.com/Write-read-XML-tf4058365.html#a11529052 Sent from the Xerces - C - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- 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]
