try {
SAXBuilder b = new SAXBuilder(true); // true -> validate
// Create a JDOM document.
Document doc = b.build(new File("parents+dtd.xml"));
// Create an output formatter, and have it write the doc.
new XMLOutputter().output(doc, System.out);
} catch (JDOMException jex) {
System.out.print("PARSE ERROR: " + jex.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
}