Loading ...
Sorry, an error occurred while loading the content.

5497Validation question

Expand Messages
  • Ger Apeldoorn
    Jul 14, 2006

      I want to use an .xsd file to validate a request that I get over SOAP. How can
      I do that?

      This is what I have:

      my $parser = XML::LibXML->new();

      sub Thingie
      # Get the hash
      my ($class, $f) = @_;
      # Check received data
      my $parsed_request = $parser->parse_string($f);
      my $schema = XML::LibXML::Schema->new("http://server/thingie.xsd");
      eval { $schema->validate($parsed_request); };
      die "**** Invalid SOAP request ****\n$@" if $@;

      my %output = ();
      $output{'dummy'} = $f->{'dummy1'}->{'dummy2'};
      return SOAP::Data->name("out" => %output);

      This does not work, because the $parser (XML::LibXML) expects a string
      containing the XML to validate.

      How can I validate my received XML?

      Thanks in advance!