Reputation: 3380
I have two node having same name. i want to modify one particular node value. For example
<names>
<name>one</name>
<name>two</name>
<name>three</name>
<name>four</name>
<name>five</name>
</names>
In the above example i want to change last node value "five" to new value "six". is this possible in DOM..?? i am new to this concept, please guide me. Thanks for valuable replies.
Upvotes: 0
Views: 1700
Reputation: 4796
Here's an example of doing exactly what you describe.
http://www.java2s.com/Code/Java/XML/JavaDOMeditLocateaNodeandChangeItsContent.htm
Upvotes: 1
Reputation: 6802
Yes. In particular, you can reference collections of child objects of 'names' as a NodeList. see Node.getChildNodes()
Upvotes: 1