Thank you so much for all your help,
it's working as well :)
Alberto Massari wrote:
>
> Hi Jerome,
>
> At 15.29 20/07/2007 -0700, jerome.mariette wrote:
>
>>Hi everyone,
>>I'm trying to import an XML file parsed with XercesDOMParser into my main
>>DOMDocument as following:
>>[...]
>> /*#####################################################
>> * add it to an other DOMDocument
>> */
>> XMLCh* rootvalue = XMLString::transcode("MainRoot");
>> DOMDocument* mainDOM = impl->createDocument(NULL, rootvalue,
>> NULL);
>> XMLString::release(&rootvalue);
>> DOMNode* domnode = domdoc->getDocumentElement();
>> DOMElement* root = itsXMLdoc->getDocumentElement();
>> root->importNode(domnode, true);
>> /*#####################################################
>> * End adding XML */
>>
>
> importNode will simply clone the source node to make it usable inside
> the new document, but it will not add it to the DOM tree; you need to
> do first import it, then append to an existing node.
> It's not clear from your example where you want to add it (you create
> a new mainDOM document, but then you don't use it; you invoke
> importNode on the root element of itsXMLdoc, but the method is
> defined on DOMDocument, not on DOMElement), so I'll try to guess:
>
> DOMNode* domnode = domdoc->getDocumentElement();
> DOMNode* newRoot=mainDOM->importNode(domnode, true);
> mainDOM->getDocumentElement()->appendChild(newRoot);
>
> Alberto
>
>
>>What am I doing wrong ?
>>thanks so much for all your help,
>>Jerome
>>--
>>View this message in context:
>>http://www.nabble.com/DOMDocument%3A%3AimportNode%28%29-tf4119877.html#a11717007
>>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]
>
>
>
--
View this message in context:
http://www.nabble.com/DOMDocument%3A%3AimportNode%28%29-tf4119877.html#a11750656
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]