title: XML syntax validation in Java
body: <p>I've been trying to figure out how to check the syntax of an XML file, make sure all tags are closed, there's no random characters, etc... All I care at this point is making sure there is no broken XML in the file.</p>
  
  <p>I've been looking at some SO posts like these...</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/1096365/validate-an-xml-file-against-local-dtd-file-with-java">Validate an XML file against local DTD file with Java</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/15732/whats-the-best-way-to-validate-an-xml-file-against-an-xsd-file">What&#39;s the best way to validate an XML file against an XSD file?</a></p></li>
  </ul>
  
  <p>... but I realized that I don't want to validate the structure of the XML file; I <strong>don't want to</strong> validate against an XML Schema (XSD)... I just want to check the XML syntax and determine if it is correct.</p>