=?ISO-8859-1?Q?Re:_[xml]_Validating_an_xml_doc_against_schema_issue?=
- From: cazic gmx net
- To: "Yong Chen (yongche)) <chen cisco com>"@gnome.org
- Cc: xml gnome org
- Subject: Re: [xml] Validating an xml doc against schema issue
- Date: Wed, 27 Jul 2005 14:18:42 +0200 (MEST)
Hi,
Von: "Yong Chen (yongche)" <chen cisco com>
Datum: Tue, 26 Jul 2005 16:55:17 -0700
I'm having a problem validating an xml file against a schema, basically
it's with "substitutionGroup".
[...]
Element "get-config" is supposed to be the substitute of "rpcOperation",
so why does the call fail?
It does probably fail due to an old version of Libxml2 you are using,
which does not yet support substitution groups. As far I can recall,
the mechanism was implemented in Libxml 2.6.19 (or earlier?). Until
recently we had problems with <xs:all> in combination with substitution
groups, but this was fixed by Daniel on the automaton side some days
ago; so I recommend using the CVS HEAD.
With the CVS HEAD I get:
P:\libxml2-lab\tests\2005-07-27>cat test.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://myns"
targetNamespace="http://myns"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="rpcOperation" type="xs:string"/>
<xs:complexType name="rpcType">
<xs:sequence>
<xs:element ref="rpcOperation"/>
</xs:sequence>
</xs:complexType>
<xs:element name="rpc" type="rpcType"/>
<xs:element name="get-config" substitutionGroup="rpcOperation"/>
</xs:schema>
P:\libxml2-lab\tests\2005-07-27>cat test.xml
<?xml version="1.0"?>
<rpc xmlns="http://myns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://myns test.xsd">
<get-config>hello</get-config>
</rpc>
P:\libxml2-lab\tests\2005-07-27>xmllint --noout --schema test.xsd test.xml
test.xml validates
Regards,
Kasimier
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]