Hi,

> Von: "Yong Chen (yongche)" <[EMAIL PROTECTED]>
> 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
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to