[xml] Schema validation fails with global definitions
- From: Israel Ganor <ganor softlink com>
- To: "'xml gnome org'" <xml gnome org>
- Subject: [xml] Schema validation fails with global definitions
- Date: Thu, 8 Apr 2004 15:48:37 +0200
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:
----------------------------------------------------------------------------
----------------
<xs:element name="BHUB-ADMIN">
<xs:complexType>
<xs:sequence>
<xs:element name="USER">
<xs:complexType>
<xs:sequence>
<xs:element ref="METHODS"/>
</xs:sequence>
<xs:attribute name="ACTION"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="METHODS" type="xs:byte"/>
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.
Thanks in advance
Israel Ganor
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]