title: XML Schema Validation with RelaxNG
body: <p>Which XML validation tools can you recommend for both performance and accuracy, each of which is a critical issue on our system?  We have the following requirements:</p>
  
  <ul>
  <li>It is <em>not</em> xmllint (see below)</li>
  <li>Supports RelaxNG</li>
  <li>Can easily integrate with Perl (this is optional, but it would be nice)</li>
  </ul>
  
  <p>Why not xmllint?  (This is background and you can skip it if you like)</p>
  
  <p>We have a large Perl system which uses RelaxNG to validate our XML.  We use the <a href="http://www.relaxng.org/compact-tutorial-20030326.html" rel="noreferrer">compact RelaxNG format</a> and <a href="http://www.thaiopensource.com/relaxng/trang.html" rel="noreferrer">trang</a> to convert it to the standard RelaxNG format.  Then we do the actual validation via <a href="http://xmlsoft.org/xmllint.html" rel="noreferrer">xmllint</a>.</p>
  
  <p>That's when the problems kick in.  xmllint routinely has issues in reporting validation errors incorrectly.  It doesn't give false positives or negatives, but if the document fails to validate, xmllint will often report the wrong element or attribute for a given error.  Sometimes the error is correct ("did not expect to see element 'bar'), but only because a previous error was not reported (because 'bar' was supposed to be following the required but missing element 'foo', but xmllint doesn't tell us that bit).  Note that this is a long-standing problem with xmllint and even the latest version has the same problems.  We often have huge XML documents and misreporting the errors causes much grief for both clients and developers.</p>