title: How can I validate XML with XSD in Perl?
body: <p>This may be a simple question for most Perl programmers, I have only used Perl for two weeks so far and am very unfamiliar with the Perl packages. </p>
  
  <p>I have a simple XSD file as below:</p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema"&gt;
      &lt;xsd:element name="elementname"&gt;
          &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
                  &lt;xsd:element name="field1" type="xsd:integer" minOccurs="0" maxOccurs="1"/&gt;
                  &lt;xsd:element name="field2" type="xsd:string" minOccurs="0" maxOccurs="1"/&gt;              
              &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
  &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>I would love to validate an XML file with the above XSD to ensure this is a valid XML. What Perl module should I use? I prefer a module that is available both on ActivePerl and Perl on *nix. Would be very helpful to post some code snippets. </p>
  
  <p>Thanks</p>