> I have the following very simple XML file:
>
[quoted text clipped - 5 lines]
>
> How do I read in and update the john, paul or steve nodes?
Have you tried reading the tutorial yet?
http://java.sun.com/xml/tutorial_intro.html

Signature
Kind regards,
Christophe Vanfleteren
> I have the following very simple XML file:
>
[quoted text clipped - 5 lines]
>
> How do I read in and update the john, paul or steve nodes?
Reading is relatively straight-forward, and so is updating.
You create a Document object:
DocumentBuilder docBuild =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = docBuild.parse(fileName);
...and then access / modify the nodes.
But to save your file, you need to create a Transformer object. Here is an
example (assuming doc is your xml Document):
try {
if (doc.getDocumentURI() == null)
throw new IOException("No file name specified.");
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(doc.getDocumentURI());
System.out.println("Saving XML file: " + doc.getDocumentURI());
// this line actually does the save
transformer.transform(source, result);
} catch (TransformerConfigurationException ex) {
throw new IOException(ex.getMessage());
} catch (TransformerException ex) {
throw new IOException(ex.getMessage());
}
Like Christophe wrote, this is explained in the tutorial. You will want to
look at the DOM model and not SAX to see how to implement this.

Signature
Josef Garvi
"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/
new income - better environment - more food - less poverty