applied a patch from Kasimier Buchcik implementing attribute uses and

* xmlschemas.c include/libxml/schemasInternals.h
  include/libxml/xmlerror.h: applied a patch from Kasimier Buchcik
  implementing attribute uses and wildcards.
* test/schemas/* result/schemas/*: added/fixed a bunch of tests
Daniel
This commit is contained in:
Daniel Veillard 2004-06-02 19:19:14 +00:00
parent 0335a846ad
commit 3646d6463d
41 changed files with 3102 additions and 243 deletions

View File

@ -1,3 +1,10 @@
Wed Jun 2 21:16:26 CEST 2004 Daniel Veillard <daniel@veillard.com>
* xmlschemas.c include/libxml/schemasInternals.h
include/libxml/xmlerror.h: applied a patch from Kasimier Buchcik
implementing attribute uses and wildcards.
* test/schemas/* result/schemas/*: added/fixed a bunch of tests
Wed Jun 2 18:15:51 CEST 2004 Daniel Veillard <daniel@veillard.com>
* globals.c xmlIO.c include/libxml/globals.h: applied patch from

View File

@ -112,27 +112,48 @@ struct _xmlSchemaAnnot {
* Apply strict validation rules on attributes
*/
#define XML_SCHEMAS_ANYATTR_STRICT 3
/**
* XML_SCHEMAS_ANY_SKIP:
*
* Skip unknown attribute from validation
*/
#define XML_SCHEMAS_ANY_SKIP 1
/**
* XML_SCHEMAS_ANY_LAX:
*
* Ignore validation non definition on attributes
*/
#define XML_SCHEMAS_ANY_LAX 2
/**
* XML_SCHEMAS_ANY_STRICT:
*
* Apply strict validation rules on attributes
*/
#define XML_SCHEMAS_ANY_STRICT 3
/**
* XML_SCHEMAS_ATTR_USE_PROHIBITED:
*
* The attribute is prohibited.
*/
#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
/**
* XML_SCHEMAS_ATTR_USE_REQUIRED:
*
* The attribute is required.
*/
#define XML_SCHEMAS_ATTR_USE_REQUIRED 1
/**
* XML_SCHEMAS_ATTR_USE_OPTIONAL:
*
* The attribute is optional.
*/
#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
/**
* XML_SCHEMAS_ATTR_GLOABAL:
*
* allow elements in no namespace
*/
#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0
/**
* XML_SCHEMAS_ATTR_NSDEFAULT:
@ -168,6 +189,68 @@ struct _xmlSchemaAttribute {
int flags;
};
/**
* xmlSchemaAttributeLink:
* Used to build a list of attribute uses on complexType definitions.
*/
typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr;
struct _xmlSchemaAttributeLink {
struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */
struct _xmlSchemaAttribute *attr;/* the linked attribute */
};
/**
* XML_SCHEMAS_WILDCARD_COMPLETE:
*
* If the wildcard is complete.
*/
#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0
/**
* xmlSchemaCharValueLink:
* Used to build a list of namespaces on wildcards.
*/
typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr;
struct _xmlSchemaWildcardNs {
struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */
const xmlChar *value;/* the value */
};
/**
* xmlSchemaWildcard.
* A wildcard.
*/
typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
typedef xmlSchemaWildcard *xmlSchemaWildcardPtr;
struct _xmlSchemaWildcard {
xmlSchemaTypeType type; /* The kind of type */
const xmlChar *id;
xmlSchemaAnnotPtr annot;
xmlNodePtr node;
int minOccurs;
int maxOccurs;
int processContents;
int any; /* Indicates if the ns constraint is of ##any */
xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */
xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */
int flags;
};
/**
* XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED:
*
* The attribute wildcard has been already builded.
*/
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
/**
* XML_SCHEMAS_ATTRGROUP_GLOBAL:
*
* The attribute wildcard has been already builded.
*/
#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
/**
* An attribute group definition.
*
@ -187,6 +270,8 @@ struct _xmlSchemaAttributeGroup {
xmlSchemaAttributePtr attributes;
xmlNodePtr node;
int flags;
xmlSchemaWildcardPtr attributeWildcard;
};
@ -196,6 +281,31 @@ struct _xmlSchemaAttributeGroup {
* the element content type is mixed
*/
#define XML_SCHEMAS_TYPE_MIXED 1 << 0
/**
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION:
*
* the simple or complex type has a derivation method of "extension".
*/
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1
/**
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION:
*
* the simple or complex type has a derivation method of "restriction".
*/
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2
/**
* XML_SCHEMAS_TYPE_GLOBAL:
*
* the type is global
*/
#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3
/**
* XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD:
*
* the complexType owns an attribute wildcard, i.e.
* it can be freed by the complexType
*/
#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4
/**
* _xmlSchemaType:
@ -224,6 +334,8 @@ struct _xmlSchemaType {
xmlSchemaFacetPtr facets;
struct _xmlSchemaType *redef;/* possible redefinitions for the type */
int recurse;
xmlSchemaAttributeLinkPtr attributeUses;
xmlSchemaWildcardPtr attributeWildcard;
};
/*
@ -267,6 +379,7 @@ struct _xmlSchemaType {
* XML_SCHEMAS_ELEM_TOPLEVEL:
*
* the element is top level
* obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
*/
#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
/**
@ -414,4 +527,3 @@ XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type);
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_INTERNALS_H__ */

View File

@ -555,6 +555,21 @@ typedef enum {
XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1778 */
XML_SCHEMAP_INVALID_ATTR_NAME, /* 1779 */
XML_SCHEMAP_REF_AND_CONTENT, /* 1780 */
XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1781 */
XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1782 */
XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1783 */
XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1784 */
XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1785 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1786 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1787 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1788 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1789 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1790 */
XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1791 */
XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1792 */
XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1793 */
XML_SCHRMAP_SRC_IMPORT_3_1, /* 1794 */
XML_SCHRMAP_SRC_IMPORT_3_2, /* 1795 */
XML_SCHEMAV_NOROOT = 1800,
XML_SCHEMAV_UNDECLAREDELEM, /* 1801 */
XML_SCHEMAV_NOTTOPLEVEL, /* 1802 */

View File

@ -0,0 +1 @@
./test/schemas/anyAttr-derive-errors1_0.xml validates

View File

@ -0,0 +1 @@
./test/schemas/anyAttr-derive1_0.xml validates

View File

View File

@ -0,0 +1 @@
./test/schemas/anyAttr1_0.xml validates

View File

View File

@ -1,3 +1,2 @@
./test/schemas/attruse_0_1.xml:3: element barA: Schemas validity error : required attribute attr on barA is missing
./test/schemas/attruse_0_1.xml:3: element barA: Schemas validity error : required attribute attr on barA is missing
./test/schemas/attruse_0_1.xml:3: element barA: Schemas validity error : required attribute attr on barA is missing
../test/schemas/attruse_0_1.xml:3: element barA: Schemas validity error : Attribute attr on barA is required but missing

View File

@ -1,3 +1,3 @@
./test/schemas/attruse_0_2.xml:6: element barC: Schemas validity error : attribute attr on barC is prohibited
./test/schemas/attruse_0_2.xml:6: element barC: Schemas validity error : attribute attr on barC is prohibited
./test/schemas/attruse_0_2.xml:6: element barC: Schemas validity error : attribute attr on barC is prohibited
../test/schemas/attruse_0_2.xml:6: element barC: Schemas validity error : Attribute attr on barC is unknown

View File

@ -0,0 +1 @@
./test/schemas/derivation-ok-extension-err_0.xsd:17: element attribute: Schemas parser error : ct-props-correct.4: Duplicate attribute use with the name "barA_1" specified

View File

@ -0,0 +1 @@
./test/schemas/derivation-ok-extension_0.xsd:17: element attribute: Schemas parser error : ct-props-correct.4: Duplicate attribute use with the name "barA_1" specified

View File

@ -0,0 +1,6 @@
./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:16: element attribute: Schemas parser error : derivation-ok-restriction.2.1.1: The "optional" attribute use "barB_1" is inconsistent with a matching "required" attribute use of the base type
./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:20: element attribute: Schemas parser error : derivation-ok-restriction.3: The "required" attribute use "barB_3" of the base type does not have a matching attribute use in the derived type
./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:23: element attribute: Schemas parser error : derivation-ok-restriction.2.2: The attribute use "barC_1" has neither a matching attribute use, nor a matching wildcard in the base type
./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:25: element attribute: Schemas parser error : derivation-ok-restriction.2.2: The attribute use "barC_2" has neither a matching attribute use, nor a matching wildcard in the base type
./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:30: element attribute: Schemas parser error : derivation-ok-restriction.2.2: The attribute use "barD_1" has neither a matching attribute use, nor a matching wildcard in the base type
./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:32: element attribute: Schemas parser error : derivation-ok-restriction.2.2: The attribute use "barD_2" has neither a matching attribute use, nor a matching wildcard in the base type

View File

@ -0,0 +1 @@
./test/schemas/derivation-restriction-anyAttr_0.xml validates

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo
xmlns="http://FOO"
xmlns:foo="http://FOO"
xmlns:bar="http://BAR"
xmlns:doo="http://DOO"
xmlns:import="http://IMPORT"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO anyAttr-derive-errors1_0.xsd">
<derive.1_1 barA="o" bar:barB="o" foo:barC="o"/>
<derive.1_4 barA="o" bar:barB="o" foo:barC="o"/>
<derive.2_1 barA="o" bar:barB="o" foo:barC="o" doo:barD="o" />
<derive.3_1 barA="o" foo:barC="o" doo:barD="o" />
<derive.4_1 bar:barB="o" foo:barC="o" doo:barD="o"/>
<derive.5_1_a barA="o" bar:barB="o" foo:barC="o" doo:barD="o" />
<derive.5_1_b barA="o" bar:barB="o" foo:barC="o" doo:barD="o" />
<derive.5_2_a bar:barB="o" foo:barC="o" doo:barD="o" />
<derive.5_2_b bar:barB="o" foo:barC="o" doo:barD="o" />
<derive.5_4_a bar:barB="o" doo:barD="o" />
<derive.5_4_b bar:barB="o" doo:barD="o" />
<derive.6_1 barA="o" bar:barB="o" foo:barC="o" doo:barD="o"/>
<derive.6_2 bar:barB="o" foo:barC="o" doo:barD="o"/>
</foo>

View File

@ -0,0 +1,223 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:foo="http://FOO" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:import="http://IMPORT"
targetNamespace="http://FOO" elementFormDefault="qualified">
<xsd:import namespace="http://IMPORT" schemaLocation="anyAttr.importA.1_0.xsd"/>
<xsd:import schemaLocation="anyAttr.importB.1_0.xsd"/>
<xsd:element name="foo">
<xsd:complexType>
<xsd:sequence>
<!-- Attribute Wildcard Union -->
<xsd:element name="derive.1_1" type="foo:type.1_1"/>
<xsd:element name="derive.1_4" type="foo:type.1_4"/>
<xsd:element name="derive.2_1" type="foo:type.2_1"/>
<xsd:element name="derive.3_1" type="foo:type.3_1"/>
<xsd:element name="derive.4_1" type="foo:type.4_1"/>
<xsd:element name="derive.5_1_a" type="foo:type.5_1_a"/>
<xsd:element name="derive.5_1_b" type="foo:type.5_1_b"/>
<xsd:element name="derive.5_2_a" type="foo:type.5_2_a"/>
<xsd:element name="derive.5_2_b" type="foo:type.5_2_b"/>
<xsd:element name="derive.5_4_a" type="foo:type.5_4_a"/>
<xsd:element name="derive.5_4_b" type="foo:type.5_4_b"/>
<xsd:element name="derive.6_1" type="foo:type.6_1"/>
<xsd:element name="derive.6_2" type="foo:type.6_2"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Attribute Wildcard Union -->
<!-- 1. If O1 and O2 are the same value, then that value must be the value. -->
<xsd:complexType name="type.1_1">
<xsd:complexContent>
<xsd:extension base="foo:type.base.1_1">
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.1_1">
<xsd:attributeGroup ref="foo:attrGr.1_1"/>
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.1_1">
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:attributeGroup>
<xsd:complexType name="type.1_4">
<xsd:complexContent>
<xsd:extension base="foo:type.base.1_4">
<xsd:anyAttribute namespace="http://BAR ##local http://FOO" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.1_4">
<xsd:attributeGroup ref="foo:attrGr.1_4"/>
<xsd:anyAttribute namespace="##local http://BAR ##targetNamespace " processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.1_4">
<xsd:anyAttribute namespace=" http://FOO http://BAR ##local"/>
</xsd:attributeGroup>
<!-- 2. If either O1 or O2 is any, then any must be the value. -->
<xsd:complexType name="type.2_1">
<xsd:complexContent>
<xsd:extension base="foo:type.base.2_1">
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.2_1">
<xsd:attributeGroup ref="foo:attrGr.2_1"/>
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.2_1">
<xsd:anyAttribute namespace="##local ##targetNamespace"/>
</xsd:attributeGroup>
<!-- 3. If both O1 and O2 are sets of (namespace names or ·absent·),
then the union of those sets must be the value. -->
<xsd:complexType name="type.3_1">
<xsd:complexContent>
<xsd:extension base="foo:type.base.3_1">
<xsd:anyAttribute namespace="##targetNamespace http://DOO" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.3_1">
<xsd:attributeGroup ref="foo:attrGr.3_1"/>
<xsd:anyAttribute namespace="##local" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.3_1">
<xsd:anyAttribute namespace="##local ##targetNamespace http://BAR"/>
</xsd:attributeGroup>
<!-- 4 If the two are negations of different values (namespace
names or ·absent·), then a pair of not and ·absent· must be the value. -->
<xsd:complexType name="type.4_1">
<xsd:complexContent>
<xsd:extension base="imp.type.base.derive.4_1">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<!-- 5 If either O1 or O2 is a pair of not and a namespace name and
the other is a set of (namespace names or ·absent·) (call this set S),
then The appropriate case among the following must be true: -->
<!-- 5.1 If the set S includes both the negated namespace name and
·absent·, then any must be the value. -->
<xsd:complexType name="type.5_1_a">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_1_a">
<xsd:anyAttribute namespace="##local ##targetNamespace" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_1_a">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.5_1_b">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_1_b">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_1_b">
<xsd:anyAttribute namespace="##local ##targetNamespace" processContents="lax"/>
</xsd:complexType>
<!-- 5.2 If the set S includes the negated namespace name but not ·absent·,
then a pair of not and ·absent· must be the value. -->
<xsd:complexType name="type.5_2_a">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_2_a">
<xsd:anyAttribute namespace="##targetNamespace http://BAR" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_2_a">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.5_2_b">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_2_b">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_2_b">
<xsd:anyAttribute namespace="##targetNamespace http://BAR" processContents="lax"/>
</xsd:complexType>
<!-- 5.3 If the set S includes ·absent· but not the negated namespace name,
then the union is not expressible. -->
<!--
<xsd:complexType name="type.5_3_a">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_3_a">
<xsd:anyAttribute namespace="##local http://BAR" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_3_a">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.5_3_b">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_3_b">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_3_b">
<xsd:anyAttribute namespace="##local http://BAR" processContents="lax"/>
</xsd:complexType>
-->
<!-- 5.4 If the set S does not include either the negated namespace name
or ·absent·, then whichever of O1 or O2 is a pair of not and a namespace
name must be the value. -->
<xsd:complexType name="type.5_4_a">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_4_a">
<xsd:anyAttribute namespace="http://BAR" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_4_a">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.5_4_b">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_4_b">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_4_b">
<xsd:anyAttribute namespace="http://BAR" processContents="lax"/>
</xsd:complexType>
<!-- 6 If either O1 or O2 is a pair of not and ·absent· and the other is a
set of (namespace names or ·absent·) (again, call this set S), then The
appropriate case among the following must be true: -->
<!-- 6.1 If the set S includes ·absent·, then any must be the value. -->
<xsd:complexType name="type.6_1">
<xsd:complexContent>
<xsd:extension base="imp.type.base.derive.6">
<xsd:anyAttribute namespace="##local http://BAR" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<!-- 6.2 If the set S does not include ·absent·, then a pair of not and ·absent·
must be the value. -->
<xsd:complexType name="type.6_2">
<xsd:complexContent>
<xsd:extension base="imp.type.base.derive.6">
<xsd:anyAttribute namespace="http://BAR http://DOO" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo
xmlns="http://FOO"
xmlns:foo="http://FOO"
xmlns:bar="http://BAR"
xmlns:doo="http://DOO"
xmlns:import="http://IMPORT"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO anyAttr-derive1_0.xsd">
<derive.1_1 barA="o" bar:barB="o" foo:barC="o"/>
<derive.1_4 barA="o" bar:barB="o" foo:barC="o"/>
<derive.2_1 barA="o" bar:barB="o" foo:barC="o" doo:barD="o" />
<derive.3_1 barA="o" foo:barC="o" doo:barD="o" />
<derive.4_1 bar:barB="o" foo:barC="o" doo:barD="o"/>
<derive.5_1_a barA="o" bar:barB="o" foo:barC="o" doo:barD="o" />
<derive.5_1_b barA="o" bar:barB="o" foo:barC="o" doo:barD="o" />
<derive.5_2_a bar:barB="o" foo:barC="o" doo:barD="o" />
<derive.5_2_b bar:barB="o" foo:barC="o" doo:barD="o" />
<derive.5_4_a bar:barB="o" doo:barD="o" />
<derive.5_4_b bar:barB="o" doo:barD="o" />
<derive.6_1 barA="o" bar:barB="o" foo:barC="o" doo:barD="o"/>
<derive.6_2 bar:barB="o" foo:barC="o" doo:barD="o"/>
</foo>

View File

@ -0,0 +1,227 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:foo="http://FOO" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:import="http://IMPORT"
targetNamespace="http://FOO" elementFormDefault="qualified">
<xsd:import namespace="http://IMPORT" schemaLocation="anyAttr.importA.1_0.xsd"/>
<xsd:import schemaLocation="anyAttr.importB.1_0.xsd"/>
<xsd:element name="foo">
<xsd:complexType>
<xsd:sequence>
<!-- Attribute Wildcard Union -->
<xsd:element name="derive.1_1" type="foo:type.1_1"/>
<xsd:element name="derive.1_4" type="foo:type.1_4"/>
<xsd:element name="derive.2_1" type="foo:type.2_1"/>
<xsd:element name="derive.3_1" type="foo:type.3_1"/>
<xsd:element name="derive.4_1" type="foo:type.4_1"/>
<xsd:element name="derive.5_1_a" type="foo:type.5_1_a"/>
<xsd:element name="derive.5_1_b" type="foo:type.5_1_b"/>
<xsd:element name="derive.5_2_a" type="foo:type.5_2_a"/>
<xsd:element name="derive.5_2_b" type="foo:type.5_2_b"/>
<xsd:element name="derive.5_4_a" type="foo:type.5_4_a"/>
<xsd:element name="derive.5_4_b" type="foo:type.5_4_b"/>
<xsd:element name="derive.6_1" type="foo:type.6_1"/>
<xsd:element name="derive.6_2" type="foo:type.6_2"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Attribute Wildcard Union -->
<!-- 1. If O1 and O2 are the same value, then that value must be the value. -->
<xsd:complexType name="type.1_1">
<xsd:complexContent>
<xsd:extension base="foo:type.base.1_1">
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.1_1">
<xsd:attributeGroup ref="foo:attrGr.1_1"/>
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.1_1">
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:attributeGroup>
<xsd:complexType name="type.1_4">
<xsd:complexContent>
<xsd:extension base="foo:type.base.1_4">
<xsd:anyAttribute namespace="http://BAR ##local http://FOO" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.1_4">
<xsd:attributeGroup ref="foo:attrGr.1_4"/>
<xsd:anyAttribute namespace="##local http://BAR ##targetNamespace " processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.1_4">
<xsd:anyAttribute namespace=" http://FOO http://BAR ##local"/>
</xsd:attributeGroup>
<!-- 2. If either O1 or O2 is any, then any must be the value. -->
<xsd:complexType name="type.2_1">
<xsd:complexContent>
<xsd:extension base="foo:type.base.2_1">
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.2_1">
<xsd:attributeGroup ref="foo:attrGr.2_1"/>
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.2_1">
<xsd:anyAttribute namespace="##local ##targetNamespace"/>
</xsd:attributeGroup>
<!-- 3. If both O1 and O2 are sets of (namespace names or ·absent·),
then the union of those sets must be the value. -->
<xsd:complexType name="type.3_1">
<xsd:complexContent>
<xsd:extension base="foo:type.base.3_1">
<xsd:anyAttribute namespace="##targetNamespace http://DOO" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.3_1">
<xsd:attributeGroup ref="foo:attrGr.3_1"/>
<xsd:anyAttribute namespace="##local" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.3_1">
<xsd:anyAttribute namespace="##local ##targetNamespace http://BAR"/>
</xsd:attributeGroup>
<!-- 4 If the two are negations of different values (namespace
names or ·absent·), then a pair of not and ·absent· must be the value. -->
<xsd:complexType name="type.4_1">
<xsd:complexContent>
<xsd:extension base="imp.type.base.derive.4_1">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<!-- 5 If either O1 or O2 is a pair of not and a namespace name and
the other is a set of (namespace names or ·absent·) (call this set S),
then The appropriate case among the following must be true: -->
<!-- 5.1 If the set S includes both the negated namespace name and
·absent·, then any must be the value. -->
<xsd:complexType name="type.5_1_a">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_1_a">
<xsd:anyAttribute namespace="##local ##targetNamespace" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_1_a">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.5_1_b">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_1_b">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_1_b">
<xsd:anyAttribute namespace="##local ##targetNamespace" processContents="lax"/>
</xsd:complexType>
<!-- 5.2 If the set S includes the negated namespace name but not ·absent·,
then a pair of not and ·absent· must be the value. -->
<xsd:complexType name="type.5_2_a">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_2_a">
<xsd:anyAttribute namespace="##targetNamespace http://BAR" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_2_a">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.5_2_b">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_2_b">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_2_b">
<xsd:anyAttribute namespace="##targetNamespace http://BAR" processContents="lax"/>
</xsd:complexType>
<!-- 5.3 If the set S includes ·absent· but not the negated namespace name,
then the union is not expressible. -->
<!--
<xsd:complexType name="type.5_3_a">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_3_a">
<xsd:anyAttribute namespace="##local http://BAR" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_3_a">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.5_3_b">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_3_b">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_3_b">
<xsd:anyAttribute namespace="##local http://BAR" processContents="lax"/>
</xsd:complexType>
-->
<!-- 5.4 If the set S does not include either the negated namespace name
or ·absent·, then whichever of O1 or O2 is a pair of not and a namespace
name must be the value. -->
<xsd:complexType name="type.5_4_a">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_4_a">
<xsd:anyAttribute namespace="http://BAR" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_4_a">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.5_4_b">
<xsd:complexContent>
<xsd:extension base="foo:type.base.5_4_b">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="type.base.5_4_b">
<xsd:anyAttribute namespace="http://BAR" processContents="lax"/>
</xsd:complexType>
<!-- 6 If either O1 or O2 is a pair of not and ·absent· and the other is a
set of (namespace names or ·absent·) (again, call this set S), then The
appropriate case among the following must be true: -->
<!-- 6.1 If the set S includes ·absent·, then any must be the value. -->
<xsd:complexType name="type.6_1">
<xsd:complexContent>
<xsd:extension base="imp.type.base.derive.6">
<xsd:anyAttribute namespace="##local http://BAR" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<!-- 6.2 If the set S does not include ·absent·, then a pair of not and ·absent·
must be the value. -->
<xsd:complexType name="type.6_2">
<xsd:complexContent>
<xsd:extension base="imp.type.base.derive.6">
<xsd:anyAttribute namespace="http://BAR http://DOO" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo
xmlns="http://FOO"
xmlns:foo="http://FOO"
xmlns:bar="http://BAR"
xmlns:import="http://IMPORT"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO file:///c:/dev/libxml2/patches/2004-05-17/anyAttr-errors1_0.xsd">
<!-- not allowed: foo:barC -->
<basic.B foo:barC="o"/>
<!-- not allowed: foo:barC -->
<basic.C foo:barC="o"/>
<!-- not allowed: barA, bar:barB -->
<basic.D barA="o" bar:barB="o"/>
<!-- not allowed: bar:barB -->
<inters.2_1 barA="o" bar:barB="o" foo:barC="o"/>
<!-- not allowed: barA, foo:barC -->
<inters.3_1 barA="o" bar:barB="o" foo:barC="o"/>
<!-- not allowed: bar:barB -->
<inters.4_1 barA="o" bar:barB="o" foo:barC="o"/>
<!-- not allowed: barA, foo:barC -->
<inters.6_1 barA="o" bar:barB="o" foo:barC="o"/>
</foo>

View File

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://IMPORT"
xmlns:imp="http://IMPORT" xmlns:boo="http://BOO">
<xsd:attributeGroup name="attrGr.inters.5_1">
<xsd:anyAttribute namespace="##other"/>
</xsd:attributeGroup>
<xsd:element name="imp.element"/>
<xsd:attribute name="imp.attribute" type="xsd:string"/>
<xsd:group name="imp.group">
<xsd:sequence>
<xsd:element ref="imp:imp.element"/>
</xsd:sequence>
</xsd:group>
<xsd:complexType name="imp.complexType">
<xsd:attribute ref="imp:imp.attribute"/>
</xsd:complexType>
</xsd:schema>

View File

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:attributeGroup name="attrGr.inters.6_1">
<xsd:anyAttribute namespace="##other"/>
</xsd:attributeGroup>
<xsd:complexType name="imp.type.base.inters.4_1">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="imp.type.base.derive.4_1">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="imp.type.base.derive.6">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
</xsd:schema>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo
xmlns="http://FOO"
xmlns:foo="http://FOO"
xmlns:bar="http://BAR"
xmlns:boo="http://BOO"
xmlns:import="http://IMPORT"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO anyAttr1_0.xsd">
<import:imp.element/>
<imp.attribute import:imp.attribute="p"/>
<imp.group>
<import:imp.element/>
</imp.group>
<basic.A bar:barA="o"/>
<basic.B bar:barB="o"/>
<basic.C barC="o"/>
<basic.D foo:barD="o"/>
<basic.E barA="o" bar:barB="o" foo:barC="o"/>
<inters.1_1 barA="o" bar:barB="o" foo:barC="o"/>
<inters.1_2 bar:barB="o"/>
<inters.1_3 barA="o" foo:barC="o"/>
<inters.1_4 barA="o" bar:barB="o" foo:barC="o"/>
<inters.2_1 barA="o" foo:barC="o"/>
<inters.3_1 bar:barB="o"/>
<inters.4_1 barA="o" foo:barC="o"/>
<!--inters.5_1 barA="o" bar:barB="o" foo:barC="o"/-->
<inters.6_1 bar:barB="o"/>
</foo>

144
test/schemas/anyAttr1_0.xsd Normal file
View File

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:foo="http://FOO" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:import="http://IMPORT"
targetNamespace="http://FOO" elementFormDefault="qualified">
<xsd:import namespace="http://IMPORT" schemaLocation="anyAttr.importA.1_0.xsd"/>
<xsd:import schemaLocation="anyAttr.importB.1_0.xsd"/>
<xsd:element name="foo">
<xsd:complexType>
<xsd:sequence>
<!-- Import -->
<xsd:element ref="import:imp.element"/>
<xsd:element name="imp.attribute">
<xsd:complexType>
<xsd:attribute ref="import:imp.attribute"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="imp.group">
<xsd:complexType>
<xsd:group ref="import:imp.group"/>
</xsd:complexType>
</xsd:element>
<!-- Basic -->
<xsd:element name="basic.A" type="foo:type.basic.A"/>
<xsd:element name="basic.B" type="foo:type.basic.B"/>
<xsd:element name="basic.C" type="foo:type.basic.C"/>
<xsd:element name="basic.D" type="foo:type.basic.D"/>
<xsd:element name="basic.E" type="foo:type.basic.E"/>
<!-- Attribute Wildcard Intersection -->
<xsd:element name="inters.1_1" type="foo:type.inters.1_1"/>
<xsd:element name="inters.1_2" type="foo:type.inters.1_2"/>
<xsd:element name="inters.1_3" type="foo:type.inters.1_3"/>
<xsd:element name="inters.1_4" type="foo:type.inters.1_4"/>
<xsd:element name="inters.2_1" type="foo:type.inters.2_1"/>
<xsd:element name="inters.3_1" type="foo:type.inters.3_1"/>
<xsd:element name="inters.4_1" type="foo:type.inters.4_1"/>
<!--xsd:element name="inters.5_1" type="type.inters.5_1"/-->
<xsd:element name="inters.6_1" type="foo:type.inters.6_1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Basic -->
<xsd:complexType name="type.basic.A">
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.basic.B">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.basic.C">
<xsd:anyAttribute namespace="##local" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.basic.D">
<xsd:anyAttribute namespace="##targetNamespace" processContents="lax"/>
</xsd:complexType>
<xsd:complexType name="type.basic.E">
<xsd:anyAttribute namespace="##targetNamespace ##local http://BAR" processContents="lax"/>
</xsd:complexType>
<!-- Attribute Wildcard Intersection -->
<!-- 1. If O1 and O2 are the same value, then that value must be the value. -->
<xsd:complexType name="type.inters.1_1">
<xsd:attributeGroup ref="foo:attrGr.inters.1_1"/>
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.inters.1_1">
<xsd:anyAttribute namespace="##any"/>
</xsd:attributeGroup>
<xsd:complexType name="type.inters.1_2">
<xsd:attributeGroup ref="foo:attrGr.inters.1_2"/>
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.inters.1_2">
<xsd:anyAttribute namespace="##other"/>
</xsd:attributeGroup>
<xsd:complexType name="type.inters.1_3">
<xsd:attributeGroup ref="foo:attrGr.inters.1_3"/>
<xsd:anyAttribute namespace="##local ##targetNamespace" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.inters.1_3">
<xsd:anyAttribute namespace="##local ##targetNamespace"/>
</xsd:attributeGroup>
<xsd:complexType name="type.inters.1_4">
<xsd:attributeGroup ref="foo:attrGr.inters.1_4"/>
<xsd:anyAttribute namespace="##local http://BAR ##targetNamespace " processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.inters.1_4">
<xsd:anyAttribute namespace=" ##targetNamespace http://BAR ##local"/>
</xsd:attributeGroup>
<!-- 2. If either O1 or O2 is any, then the other must be the value. -->
<xsd:complexType name="type.inters.2_1">
<xsd:attributeGroup ref="foo:attrGr.inters.2_1"/>
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.inters.2_1">
<xsd:anyAttribute namespace="##local ##targetNamespace"/>
</xsd:attributeGroup>
<!-- 3. If either O1 or O2 is a pair of not and a value (a namespace name or ·absent·)
and the other is a set of (namespace names or ·absent·), then that set, minus the
negated value if it was in the set, minus ·absent· if it was in the set, must be the value. -->
<xsd:complexType name="type.inters.3_1">
<xsd:attributeGroup ref="foo:attrGr.inters.3_1"/>
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.inters.3_1">
<xsd:anyAttribute namespace="##local ##targetNamespace http://BAR"/>
</xsd:attributeGroup>
<!-- 4. If both O1 and O2 are sets of (namespace names or ·absent·), then the
intersection of those sets must be the value. -->
<xsd:complexType name="type.inters.4_1">
<xsd:attributeGroup ref="foo:attrGr.inters.4_1"/>
<xsd:anyAttribute namespace="##local ##targetNamespace http://BAR" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGr.inters.4_1">
<xsd:anyAttribute namespace="##local ##targetNamespace"/>
</xsd:attributeGroup>
<!-- 5. If the two are negations of different namespace names,
then the intersection is not expressible. -->
<!--
<xsd:complexType name="type.inters.5_1">
<xsd:attributeGroup ref="import:attrGr.inters.5_1"/>
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
-->
<!--6. If the one is a negation of a namespace name and the other is a negation of ·absent·,
then the one which is the negation of a namespace name must be the value.
This one uses an attribute group from an imported schema with no targetNamespace.
-->
<xsd:complexType name="type.inters.6_1">
<xsd:attributeGroup ref="attrGr.inters.6_1"/>
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
<xsd:attributeGroup name="attrGrA">
<xsd:anyAttribute namespace="##targetNamespace"/>
</xsd:attributeGroup>
</xsd:schema>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="bug141333.xsd" attrA="valueA">
<bar attrA="valueA" attrB="valueB"/>
</foo>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">
<xs:element name="foo" type="baseType"/>
<xs:complexType name="baseType">
<xs:all>
<xs:element name="bar" type="derivedType" minOccurs="0"/>
</xs:all>
<xs:attribute name="attrA" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="derivedType">
<xs:complexContent>
<xs:extension base="baseType">
<xs:attribute name="attrB" type="xs:string" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo xmlns="http://FOO"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO derivation-ok-extension-err_0.xsd"
barA_1="o" barA_2="o"/>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://FOO" targetNamespace="http://FOO">
<xs:element name="foo">
<xs:complexType>
<xs:complexContent>
<xs:extension base="typeA">
<xs:attribute name="barA_1" type="xs:string" use="optional"/>
<xs:attribute name="barA_2" type="xs:string" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="typeA">
<xs:attribute name="barA_1" type="xs:string" use="required"/>
</xs:complexType>
</xs:schema>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo xmlns="http://FOO"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO derivation-ok-extension_0.xsd"
barA_1="o" barA_2="o"/>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://FOO" targetNamespace="http://FOO">
<xs:element name="foo">
<xs:complexType>
<xs:complexContent>
<xs:extension base="typeA">
<xs:attribute name="barA_2" type="xs:string" use="required"/>
<xs:attribute name="barA_1" type="xs:string" use="prohibited"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="typeA">
<xs:attribute name="barA_1" type="xs:string" use="required"/>
</xs:complexType>
</xs:schema>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo xmlns="http://FOO"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO derivation-ok-restriction-2-1-1_0.xsd"/>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://FOO" targetNamespace="http://FOO">
<xs:element name="foo">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="typeA">
<xs:attribute name="barA_1" type="xs:string" use="optional"/>
<!-- OK -->
<xs:attribute name="barA_2" type="xs:string" use="required"/>
<!-- OK -->
<xs:attribute name="barA_3" type="xs:string" use="prohibited"/>
<!-- OK -->
<xs:attribute name="barB_1" type="xs:string" use="optional"/>
<!-- 2.1.1 inconsistent ( OR 3 ) -->
<xs:attribute name="barB_2" type="xs:string" use="required"/>
<!-- OK -->
<xs:attribute name="barB_3" type="xs:string" use="prohibited"/>
<!-- 3 -->
<xs:attribute name="barC_1" type="xs:string" use="optional"/>
<!-- 2.2 no match in base -->
<xs:attribute name="barC_2" type="xs:string" use="required"/>
<!-- 2.2 no match in base -->
<xs:attribute name="barC_3" type="xs:string" use="prohibited"/>
<!-- OK -->
<xs:attribute name="barD_1" type="xs:string" use="optional"/>
<!-- 2.2 no match in base -->
<xs:attribute name="barD_2" type="xs:string" use="required"/>
<!-- 2.2 no match in base -->
<xs:attribute name="barD_3" type="xs:string" use="prohibited"/>
<!-- OK -->
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="typeA">
<xs:attribute name="barA_1" type="xs:string" use="optional"/>
<xs:attribute name="barA_2" type="xs:string" use="optional"/>
<xs:attribute name="barA_3" type="xs:string" use="optional"/>
<xs:attribute name="barB_1" type="xs:string" use="required"/>
<xs:attribute name="barB_2" type="xs:string" use="required"/>
<xs:attribute name="barB_3" type="xs:string" use="required"/>
<xs:attribute name="barC_1" type="xs:string" use="prohibited"/>
<xs:attribute name="barC_2" type="xs:string" use="prohibited"/>
<xs:attribute name="barC_3" type="xs:string" use="prohibited"/>
</xs:complexType>
</xs:schema>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo
xmlns:f="http://FOO" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bar="http://BAR"
xsi:noNamespaceSchemaLocation="file:///c:/dev/libxml2/patches/2004-05-17/derivation-restriction-anyAttr_0.xsd"
>
<bar barA="ooo" />
</foo>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified">
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:element name="bar" type="typeA"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attrGrA">
<xs:anyAttribute namespace="##targetNamespace"/>
</xs:attributeGroup>
<xs:complexType name="typeA">
<xs:attributeGroup ref="attrGrA" />
<xs:anyAttribute namespace="##targetNamespace" processContents="lax"/>
</xs:complexType>
</xs:schema>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo xmlns="http://FOO"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO file:///c:/dev/libxml2/patches/2004-05-17/derivation-restriction-anyType.xsd"
barA_2="xxx"/>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://FOO" targetNamespace="http://FOO">
<xs:element name="foo">
<xs:complexType>
<xs:complexContent>
<xs:extension base="xs:anyType">
<xs:attribute name="barA_1" type="xs:string" use="optional"/>
<!-- OK -->
<xs:attribute name="barA_2" type="xs:string" use="required"/>
<!-- OK -->
<xs:attribute name="barA_3" type="xs:string" use="prohibited"/>
<!-- OK -->
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>

File diff suppressed because it is too large Load Diff