How to traverse through all the nodes in an XML document

Murtaza Tinwala

Usenet Archive
Joined
Aug 18, 2004
Messages
4
Reaction score
0
Hello friends,

I have a XML document and I want to modify some of its nodes. What I need to do is traverse through all the nodes and test the name of each. If the node is to be modified, I would output the modified code or I would output the same code.

Is there any way I can get all nodes from the root node? Or, let me put this question in another way. Is there an easy way to modify XML document. Say, I want to make minor changes to an XML document and donot want to touch the rest of the document? How can I do this?

Murtaza.
 

Sebastian Kerekes

Usenet Archive
Joined
Sep 1, 2004
Messages
16
Reaction score
0
Murtaza said:
Is there any way I can get all nodes from the root node? Or, let me put this question in another way. Is there an easy way to modify XML document. Say, I want to make minor changes to an XML document and donot want to touch the rest of the document? How can I do this?

Murtaza.

You could do your changes using XSLT and use XPath to get the nodes you want to edit. An expression like "//*" gets all the nodes in the XML document. For a quick introduction to XSLT and XPath have a look at http://www.w3schools.com/ .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,224
Members
248,132
Latest member
henrywalsh

Latest Threads

Top