Validation with XSD using XML::LibXML::Schema, and XML::Validator::Schema



Both XML::LibXML::Schema and XML::Validator::Schema error when I
attempt to validate, yet the XML and XSD files appear to be perfectly
fine.

XML::LibXML::Schema errors with:
Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref':
References from this schema to components in the namespace '' are not
allowed, since not indicated by an import statement.

Code:

my $parser = XML::LibXML->new();
my $doc = $parser->parse_file("TV.xml");
my $v = XML::LibXML::Schema->new(location=>"TV.xsd");
eval { $v->validate($doc); };
die $@ if $@;

+++++++++++++++++++++++++++

XML::Validator::Schema errors with:
Found <simpleType> illegally combined with <complexType>.
at
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/XML/LibXML/SAX.pm
line 64
at ./transform.pl line 234

<simpleType> is allowed to be nested withen a <complexType> correct? As
the examples I have seen on the w3c's schema tutorial nest them.
LibXML's error, well I thought a "ref" to a element withen the same
namespace (none) is perfectly ok.

Code:

my $v = XML::Validator::Schema->new(file=>"TV.xsd");
my $p = XML::SAX::ParserFactory->parser(handler=>$v);
eval { $p->parse_uri("TV.xml") };
die $@ if $@;

Both fXML and XSD files are quite long, but I will post if necessary.
Im not sure these errors are do to a problem with Perl's
implementation, in javax.xml.validation.Validator they validated ok;
maybe Java's implementation is more relaxed....?

Thanks in advance

.