aspose file tools*
The moose likes XML and Related Technologies and the fly likes How to Go To Certain XML Nodes and Update Their Values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to Go To Certain XML Nodes and Update Their Values" Watch "How to Go To Certain XML Nodes and Update Their Values" New topic
Author

How to Go To Certain XML Nodes and Update Their Values

Natalie Kopple
Ranch Hand

Joined: May 06, 2003
Posts: 325
Hi, I have a XML file. I have problem with going to certain nodes and need help.

For example, I want to update the value "000001101" of the <content ID="f002">000001101</content> for the <item ID="SSN">. I can go ClinicalDocument/component/structureBody/component/section/text/list/, thereafter, I do not know how to proceed to get to the <content ID="f002">.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18886
    
    8

I would probably use the DOM parser for that. And if I did, I would certainly use XPath to identify the element I wanted to work with.
Randy Miller
Ranch Hand

Joined: Feb 13, 2012
Posts: 44
Hi Natalie!

I agree with Paul, XPath should do the trick.You should try something like this right here:



And after using the correct XPath to content ID(in expression) and the correct path to your XML File, you may read the value contained inside the item.
Now all you need to do is to overwrite this specific value and it´s done ;)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Go To Certain XML Nodes and Update Their Values