Re: How to validate a "ref" using XML::LibXML and/or xmllint
Paulo SantAnna <[email protected]> Thu, 23 Jun 2011 16:52:32 -0700
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
Hi Michael,
Thanks for your response.
I see. The part I missed was to pass the file to the --schema param:
$ xmllint --noout -schema /tmp/example.xml /tmp/example.xml
/tmp/example.xml:9: element element: Schemas parser error : Element '{
http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value
'interface' does not resolve to a(n) element declaration.
WXS schema /tmp/example.xml failed to compile
This makes sense as this xml is actually a xsd file. In Perl it works too.
The step:
my $schema = eval { XML::LibXML::Schema->new(location => "example.xml" ) };
Catches the ref issue too. Before I was just doing:
xmllint --noout example.xml
And I think that is why it was not catching the "ref" issue as it is a XSD
constraint not an XML one.
Thanks!
Paulo
On Thu, Jun 23, 2011 at 2:41 PM, Michael Ludwig <[email protected]> wrote:
> Paulo SantAnna schrieb am 23.06.2011 um 10:11 (-0700):
>
> > Fails validation with XMLSpy with the error (since I missed the "s" in
> > interfaces):
> >
> > 'interface' must refer to an existing document
> >
> > Both xmllint and XML::LibXML seem to ignore this error.
>
> Haven't checked the Perl interface, but xmllint works - eh, fails fine
> for me:
>
> $ xmllint --noout --schema /tmp/s.xml /tmp/d.xml
> Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref':
> The QName value 'interface' does not resolve to a(n) element
> declaration.
> WXS schema /tmp/s.xml failed to compile
>
> $ xmllint --version
> xmllint: using libxml version 20707
> compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1
> FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude
> Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron
> Modules Debug Zlib
>
> --
> Michael Ludwig
> _______________________________________________
> Perl-XML mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs