validating against a Schema

Lev Lvovsky <[email protected]> Mon, 5 Mar 2007 16:46:27 -0800
Newsgroups gmane.text.xml.xerces-p.devel
Message-ID <[email protected]>
Hello, I'm looking to validate an xml document against a vendor  
provided Schema definition, and am running into some inexplicable  
problems.  I've a really simple implementation for testing as follows:

------
#!/usr/bin/perl -w

use strict;
use XML::Xerces qw(error);

XML::Xerces::XMLPlatformUtils::Initialize();

my $parser = new XML::Xerces::XercesDOMParser;
my $error_handler = new XML::Xerces::PerlErrorHandler;
$parser->setErrorHandler($error_handler);

$parser->setDoNamespaces(1);
$parser->setDoSchema(1);

$parser->setExternalNoNamespaceSchemaLocation('test.xsd');
#$parser->setExternalSchemaLocation('test.xsd');
$parser->parse('some.xml');
------

running the code using no namespaces, I simply get the following  
warning at the last tag of the XML file.

"MESSAGE: Attribute 'xmlns' has already been declared for element  
'schema'"

running the code using namespaces (which seem to be provided in the  
xml file), I get the following error:

"MESSAGE: The schemaLocation attribute does not contain pairs of  
values."

This *seems* erroneous, as the schemaLocation attribute does contain  
a pair of values...

In the end, even when specifying no namespaces, modification of the  
xsd file which should break the validation has no effect.  Changing  
the target XML file has no effect either.  If anyone can suggest any  
pointers or docs to read, it would be greatly appreciated!

thanks!
-lev