I've seen several posts regarding XML processing with Java, however none that I've found address my current problem.
I've developed an XMLFileHandler class that loads a given xml file into a Document object, and supports some basic methods such as getRootElement(), getChildNode(), getChildNodes(), getNodeAttributeValue(), etc., etc., etc....
This behaviour has been sufficient enough for accessing nodes/values/attributes in the XML document, but my client has now added a requirement to enable editing of some of these values within the XML document.
I've tried (and failed) at developing a method to do this. The XML file is in the following format:
<?xml version="1.0" encoding="UTF-8" ?> <locations> <location id="1" name="location_name"> <a>some text</a> <b>some other text</b> </location> ... ... ... </locations>
Where the attributes 'id' AND 'name' can (each) uniquely identify EVERY 'location' node.
So, the required functionality would be to design a method that can get a 'location' node by a given 'location_name' attribute value, and then set both the 'a' and 'b' sub-node values, and save the changes to the XML file.
Any suggestions or pointers would be great!
Thanks for your help in advance.