I have an XML file and I know the node name I need to change the value for.
The nodename is ipAddress.
I can use JDOM, get document, get node and change the value and write it or I can write an XSLT file.
The code changing value goes from Java, so my question is which option is better? The size of the XML file can be different.
Another XSLT-related question: Is it possible to write an XSLT file such that I will not be listing all nodes that are in XML but will just specify like if node == ipAddress, then take the new value, and how would I apply the XSLT transformation from Java?
Thank you.
You could use the standard org.w3c.dom APIs to get a DOM. Then get the node using the standard javax.xml.xpath APIs. And then use the javax.xml.transform APIs to write it back out.
Something like: