I am trying to manipulate an xml file by reading the document, finding a specific attribute and changing its value. I have written the DOM and but I can't access the attribute or its value. Could someone help me with this. Im using the code below as practice:
<author>Lewis and Lofus</author>
say for instance i was trying to change the value in the entry id attribute.
Hey you can use Xpath inside the document to fetch the node like this
Then get the attribute of it and you can either remove the node and add the fresh node with new attribute id.
I would recommend to use the XSLT to manage this if the XML transformations is very frequent
Hi, thanks so much for responding. Unfortunately, I didnt completely understand what you were talking about. I am a 1st yr college student and this is my first time working with xml. I am trying to write the code in Java, does what you explained work with the JAVA API for xml?