How could I convert a XML Document to a Java Object (or Array)? I readed the XML like this:
DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInsta
Use XStream.
Object to XML
Person joe = new Person("Joe", "Walnes");
joe.setPhone(new PhoneNumber(123, "1234-456"));
joe.setFax(new PhoneNumber(123, "9999-999"));
String xml = xstream.toXML(joe);
The resulting XML looks like this:
Joe
Walnes
123
1234-456
123
9999-999
XML to Object
Person newJoe = (Person)xstream.fromXML(xml);
Also see
Reference
Simple