How to parse XML
The only class you need is XMLDocument, which implements XML interface and works with your default DOM implementation:
import com.jcabi.xml.XML;
import com.jcabi.xml.XMLDocument;
public class Main {
public void main(String[] args) {
XML xml = new XMLDocument(
"<orders><order id="4">Coffee to go</order></orders>"
);
String id = xml.xpath("//order/@id").get(0);
String name = xml.xpath("//order[@id=4]/text()");
}
}