File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Go To Certain XML Nodes and Update Their Values

 
Natalie Kopple
Ranch Hand
Posts: 325
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20208
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic