title: Why does my XSD file fail to parse with XML::LibXML?
body: <p>I am trying to validate an XML against schema using <a href="http://search.cpan.org/perldoc/XML::LibXML::Schema" rel="nofollow noreferrer">LibXML::Schema Validator</a> CPAN module. In that same script am using <a href="http://search.cpan.org/dist/XML-DOM/" rel="nofollow noreferrer">XML::DOM</a> CPAN module to parse the XML. I want my script to take XML file validate it against XSD and parse it. </p>
  
  <p>When I try to run the script, after validating against xsd it exits and does not parse XML. I want it parse the XML file if it is valid and generate DOM structure. I would really appreciate if someone could share some insights on it. </p>
  
  <pre><code>#usr/bin/perl -w
  use XML::LibXML;
  
  my $schema = XML::LibXML::Schema-&gt;new(location =&gt;'export.xsd');
  my $parser = XML::LibXML-&gt;new;
  
  my $xml    = 'Export.xml';
  my $doc    = $parser-&gt;parse_file($xml);
  
  eval { $schema-&gt;validate( $doc ) };
  print $@ if $@;
  
  print "$xml is valid\n";
  
  use XML::DOM;
  #use strict;
  
  my $parser = new XML::DOM::Parser;
  my $doc = $parser-&gt;parsefile ("Export.xml");
  
  my $productOfferingnodes = $doc-&gt;getElementsByTagName("productOfferings")-&gt;item(0);
  my @productOffering = $productOfferingnodes-&gt;getChildNodes();
      {
          foreach  my $productOffering(@productOffering) 
          {
              if ($productOffering-&gt;getNodeType == ELEMENT_NODE)
              {
                  print $productOffering-&gt;getNodeName; 
                       }
               }
       } 
  </code></pre>
  
  <p>Error Message:</p>
  
  <p><code>Schemas parser error : Failed to parse the XML resource 'export.xsd'.</code></p>