Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CloneNode not working

Status
Not open for further replies.

sschantz

Programmer
Joined
Aug 10, 2001
Messages
9
Location
CA
HI,

I am using VC++ 6.0 and MSXML 4.0. I am trying to copy the node matching a
XPATH from one DOMDocument to an other document.

CXMLDOMNodeList itemList = xmlDOMSrc.SelectNodes(sXPath);
for (int i=0; i< itemList.GetLength(); i++) {
itemNode = itemList.NextNode();
if(itemNode){
newNode = itemNode.CloneNode(1);
xmlDOMDst.AppendChild(newNode);
}
}



The problem is that none of the child node of itemNode is cloned.

Any one has an idea why CloneNode is not working properly?

Thank you

itemNode XML sample:
<ITEM Code=&quot;WORCHESTERSHIRE&quot; SupplierCode=&quot;&quot; Description=&quot;WOSCHESTERSHIRE&quot;
Completed=&quot;1&quot;>
<PRICE>1397</PRICE>
<ORDERED_QTY>31000</ORDERED_QTY>
<DELIVERY_QTY>14127</DELIVERY_QTY>
<DELIVERY_DATE>2002-08-13</DELIVERY_DATE>
<PURCHASE_FORMAT Id=&quot;6&quot; Description=&quot;CASE&quot;/>
<UNDELIVERY_REASON Id=&quot;0&quot; Description=&quot;&quot;/>
<TOTAL>43307</TOTAL><LAST_COST>0</LAST_COST><LAST_SUPPLIER
Code=&quot;&quot; Name=&quot;&quot;/></ITEM>

newNode XML sample:
<ITEM Code=&quot;WORCHESTERSHIRE&quot; SupplierCode=&quot;&quot; Description=&quot;WOSCHESTERSHIRE&quot;
Completed=&quot;1&quot;>
</ITEM>&quot;

 
I am working with XERCES mainly, but the DOM specification is pretty much the same for both, that's why I am replying to this...
In Xerces, the cloneNode method has a bool argument specifying if the cloning would be a &quot;deep&quot; clone or not.
Is that what CloneNode(1) stands for in your statement?
Maybe this is too obvious, but try
CloneNode(VARIANT_TRUE)... [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Thank you

This is working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top