You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Alberto Massari (Closed) (JIRA)" <xe...@xml.apache.org> on 2011/12/27 12:08:31 UTC
[jira] [Closed] (XERCESC-1973) problem while impoting node form one
document and writing to the other document.
[ https://issues.apache.org/jira/browse/XERCESC-1973?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alberto Massari closed XERCESC-1973.
------------------------------------
Resolution: Not A Problem
Please don't open bugs for asking questions; use the c-users@xerces.apache.org mailing list
> problem while impoting node form one document and writing to the other document.
> --------------------------------------------------------------------------------
>
> Key: XERCESC-1973
> URL: https://issues.apache.org/jira/browse/XERCESC-1973
> Project: Xerces-C++
> Issue Type: Bug
> Components: DOM
> Affects Versions: 2.8.0
> Environment: SunOs, Linux
> Reporter: Dinesh Reddy
> Labels: xerces
> Fix For: 2.8.0
>
> Original Estimate: 168h
> Remaining Estimate: 168h
>
> I am trying to import node from one document and adding that node to the other document...
> corrupt_impl = DOMImplementationRegistry::getDOMImplementation(XML);
> if (corrupt_impl != NULL)
> {
> /* create the document */
> corruptedDoc = corrupt_impl->createDocument(
> NULL, // root element namespace URI.
> inRoot->getNodeName(), // root element name
> NULL); // document type object (DTD).
> /* get the pointer to the root element */
> corruptedRoot = corruptedDoc->getDocumentElement();
> }
> Loop()
> {
> DOMNode* corrupted = List(i); /* getting the node from other document */
> corruptedRoot->appendChild(corruptedDoc->importNode(corrupted, true));
> }
> DOMErrorHandler *WriterErrHandler = (DOMErrorHandler*) new HandlerBase();
> corruptwriter->setErrorHandler(WriterErrHandler);
> /* set the features to the writer.*/
> if(corruptwriter->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true))
> corruptwriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint , true);
> /* write the entire document to the file */
> corruptwriter->writeNode(corruptfile , *corruptedDoc);
> corruptedDoc->release();
>
> if I run the code every time when the Loop() repeats new node is added to the root only but in the previous line like this.
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> <personnel>
> <person id="one.worker">
> <name>
> <family>Worker</family>
> <given>One</given>
> </name>
> <email>one@foo.com</email>
> </person><person id="three.worker">
> <name>
> <family>Worker</family>
> <given>One</given>
> </name>
> <email>one@foo.com</email>
> </person>
> </personnel>
> But I need the output as following. How can I achieve it..
>
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> <personnel>
> <person id="one.worker">
> <name>
> <family>Worker</family>
> <given>One</given>
> </name>
> <email>one@foo.com</email>
> </person>
> <person id="three.worker">
> <name>
> <family>Worker</family>
> <given>One</given>
> </name>
> <email>one@foo.com</email>
> </person>
> </personnel>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org