How to validate a "ref" using XML::LibXML and/or xmllint
Paulo SantAnna <[email protected]> Thu, 23 Jun 2011 10:11:57 -0700
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I'm trying to validate that ref attributes reference existing elements. For
example:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="configuration">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" ref="interface" />
<xs:element minOccurs="0" maxOccurs="1" ref="protocols" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="interfaces" type="xs:string"/>
<xs:element name="protocols" type="xs:string"/>
</xs:schema>
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. I guess
is not hard to write Perl code to do that it using XML::XPath and friends
but
am I missing something here? Maybe some kind of "strict" mode that would
allow
this validation to occur?
Thanks,
Paulo
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs