diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-09-17 07:15:29 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-09-17 07:15:29 +0200 |
commit | f0510d2f90467de8e8f260b47d79a9baaf9bef17 (patch) | |
tree | 0b9929946f06a9cbe9b9e8f2a7600dae4e048f79 /tests/cxx/parser/validation/attribute/test.xsd |
Start tracking XSD with git
Diffstat (limited to 'tests/cxx/parser/validation/attribute/test.xsd')
-rw-r--r-- | tests/cxx/parser/validation/attribute/test.xsd | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/cxx/parser/validation/attribute/test.xsd b/tests/cxx/parser/validation/attribute/test.xsd new file mode 100644 index 0000000..833eb8e --- /dev/null +++ b/tests/cxx/parser/validation/attribute/test.xsd @@ -0,0 +1,71 @@ +<?xml version="1.0"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test"> + + + <!-- Test optional and required attributes as well as a wildcard. --> + <complexType name="pass-a"> + <attribute name="a" type="string" use="optional"/> + <attribute name="b" type="string" use="required"/> + <anyAttribute namespace="##targetNamespace" processContents="skip"/> + </complexType> + + + <!-- Test that in inheritance attributes are checked before wildcards. --> + <complexType name="pass-b-base"> + <attribute name="a" type="string"/> + <anyAttribute namespace="#any" processContents="skip"/> + </complexType> + + <complexType name="pass-b"> + <complexContent> + <extension base="t:pass-b-base"> + <attribute name="b" type="string"/> + <anyAttribute namespace="#any" processContents="skip"/> + </extension> + </complexContent> + </complexType> + + + <!-- Test that in inheritance by restriction required attribute is + checked for even though it is not explicitly mentioned in + derived. --> + <complexType name="pass-c-base"> + <attribute name="a" type="string" use="required"/> + <attribute name="b" type="string" use="optional"/> + </complexType> + + <complexType name="pass-c"> + <complexContent> + <restriction base="t:pass-c-base"> + <attribute name="b" type="string" use="required"/> + </restriction> + </complexContent> + </complexType> + + + <!-- Test detection of missing required attribute. --> + <complexType name="fail-base"> + <attribute name="a" type="string" use="optional"/> + </complexType> + + <complexType name="fail"> + <complexContent> + <restriction base="t:fail-base"> + <attribute name="a" type="string" use="required"/> + </restriction> + </complexContent> + </complexType> + + + <complexType name="type"> + <sequence> + <element name="pass-a" type="t:pass-a"/> + <element name="pass-b" type="t:pass-b"/> + <element name="pass-c" type="t:pass-c"/> + <element name="fail" type="t:fail"/> + </sequence> + </complexType> + + <element name="root" type="t:type"/> + +</schema> |