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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extracting xml from xml

Status
Not open for further replies.

YYYYUU

Programmer
Dec 13, 2002
47
GB
I have xml as follows:

<control>
<details>
<name>
<firstname>fred</firstname>
<surname>smith</surname>
</name>
</details>
<details>
<name>
<firstname>john</firstname>
<surname>smith<surname>
</name>
</details>
<control>

I want to extract so that I have xml as follows:

<firstname>fred</firstname><firstname>john</firstname>

The original xml is first loaded into MSXML2.IXMLDOMNode

How can I do this? (I'm using vb)
 
Use the cloneNode method of the IXMLDOMNode object with the Deep argument set to True to create a clone of the node.

Add the cloned object to a new DOMDocument object using appendChild and save if it you wish.

You can't add the original node because it belongs to a different DOMDocument and owes it existence to that object.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top