How to consume XML with Java?

Could have been easier, no?

I have this nice sample xml file, which is called library.xml...
<library>
    <catalog>
        <book id="bk101">
            <author>Gambardella, Matthew</author>
            <title>XML Developer's Guide</title>
            <genre>Computer</genre>
            <price>44.95</price>
            <publish_date>2000-10-01</publish_date>
            <description>Nice book!</description>
        </book>
        <book id="bk102">
            <author>Ralls, Kim</author>
            <title>Midnight Rain</title>
            <genre>Fantasy</genre>
            <price>5.95</price>
            <publish_date>2000-12-16</publish_date>
            <description>Some description here.</description>
        </book>
        <book id="bk103">
            <author>Corets, Eva</author>
            <title>Maeve Ascendant</title>
            <genre>Fantasy</genre>
            <price>5.95</price>
            <publish_date>2000-11-17</publish_date>
            <description>Best book ever!</description>
        </book>
    </catalog>
</library>

Here is the Java code:
package biz.tugay.deleteNow;
/* User: koray@tugay.biz Date: 19/12/15 Time: 18:12 */
 
import com.sun.org.apache.xpath.internal.XPathAPI;
import com.sun.org.apache.xpath.internal.objects.XObject;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
 
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
 
public class OtherTestClass {
 
    public static void main(String[] args) throws Exception {
        Document doc = getDocument();
        String xpath = "/library/catalog/book[2]/author";
        extractInfo(xpath, doc);
        xpath = "/library/catalog/book[2]/title";
        extractInfo(xpath, doc);
        getRootNodeAndPrint(doc);
    }
 
    private static Document getDocument() throws Exception {
        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
 
        // Parse the XML file and build the Document:
        Document doc = docBuilder.parse(new File("/Users/koraytugay/Desktop/library.xml"));
        return doc;
    }
 
    private static void extractInfo(String xpath, Document doc) throws Exception {
        System.out.print("Result for xpath: " + xpath + ": ");
        // Catches the first node that meets the criteria of xpath string
        XObject eval = XPathAPI.eval(doc, xpath);
        System.out.println(eval);
    }
 
    private static void getRootNodeAndPrint(Document doc) {
        Node root = doc.getDocumentElement();
        System.out.print("Root element of the doc is: " + root.getNodeName() + ".");
    }
}

And finally the output:
Result for xpath: /library/catalog/book[2]/author: Ralls, Kim
Result for xpath: /library/catalog/book[2]/title: Midnight Rain
Root element of the doc is: library.