Re: [xml] Schema validation fails with global definitions



On Thu, Apr 08, 2004 at 03:48:37PM +0200, Israel Ganor wrote:
Validating this simple file using xmlSchemaValidateDoc() (Windows libxml
2.6.7) always gives the error "Element USER content check failure":

<BHUB-ADMIN xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="BrainSchema.xsd">
      <USER ACTION="modify">
              <METHODS>5</METHODS>
      </USER>
</BHUB-ADMIN>

The schema fragment looks as follows:
--------------------------------------------------------
<xs:element name="BHUB-ADMIN">
      <xs:complexType>
              <xs:sequence>
                      <xs:element ref="USER"/>
              </xs:sequence>
      </xs:complexType>
</xs:element>
<xs:element name="METHODS" type="xs:byte"/>
<xs:element name="USER">
      <xs:complexType>
              <xs:sequence>
                      <xs:element ref="METHODS"/>
              </xs:sequence>
              <xs:attribute name="ACTION"/>
      </xs:complexType>
</xs:element>

Te error is resolved if I replace the global definition of USER (<xs:element
ref="USER"/>) by a local definition as follows:
[..]

Doesn't libxml2 support global elements?
This is a great problem for me since I have huge schemas with complex
hierarchy, and many of the elements are common and referenced from several
elements.

  I can't really make sense of a "schemas fragment". It seems to me
this should work, but since you didn't provided a complete example 
I can't really reproduce the problem. Can you post the full xsd (or 
a reduced version of it rather).

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]