Tests for XSD 1.1 open content models A number of tests, both valid and invalid, demonstrating use of the new XSD 1.1 feature for open content models. Basic suffixed open content Allows any element in specified namespace at end of content Valid, uses open content. Valid, uses open content. Valid, with no open content. Invalid, open content must come last. Invalid, open content comes before mandatory elements. Invalid, suffixed content does not match wildcard. Invalid, suffixed content does not match wildcard. Suffixed open content defined by defaultOpenContent element Same as open001 except for the schema. Valid, uses open content. Valid, uses open content. Valid, with no open content. Invalid, open content must come last. Invalid, open content comes before mandatory elements. Invalid, suffixed content does not match wildcard. Invalid, suffixed content does not match wildcard. Explicit open content takes precedence over default open content Different namespaces for the local open content and default open content wildcards. Valid, uses local open content. Invalid, uses default open content namespace. mode="none" takes precedence over default open content Open content not allowed. Valid, no open content. Invalid, uses default open content namespace. Basic interleaved open content Allows any element in specified namespace anywhere in content Valid, uses open content. Valid, uses open content. Valid, with open content. Valid, with no open content. Invalid, open content does not match wildcard. Invalid, does not match regular content model. Invalid, suffixed content does not match wildcard. Basic interleaved open content using defaultOpenContent definition Allows any element in specified namespace anywhere in content. Same as open005 except for the schema. Valid, uses open content. Valid, uses open content. Valid, with open content. Valid, with no open content. Invalid, open content does not match wildcard. Invalid, does not match regular content model. Invalid, suffixed content does not match wildcard. Interleaved open content within a counting content model Designed to test that counting still works correctly. Valid, uses open content. Valid, uses open content. Invalid, maxOccurs violation. Invalid, minOccurs violation. Interleaved open content in an xs:all group Allows any element in specified namespace anywhere in xs:all content Valid, uses open content. Valid, uses open content. Valid, uses open content. Invalid, open content in wrong namespace. Invalid, too many a elements. Invalid, too few a elements. Suffix open content in an xs:all group Allows any element in specified namespace at end of xs:all content Valid, uses open content. Valid, no open content. Invalid, open content in wrong place. Invalid, too few a elements. Open content in an (otherwise) empty content model Allows any element in specified namespace Valid, uses open content. Valid, no open content. Invalid, content does not match open content wildcard. Invalid, text content not allowed Open content in an (otherwise) empty content model Defined by defaultOpenContent with appliesToEmpty=true. Uses same instances as open010. Valid, uses open content. Valid, no open content. Invalid, content does not match open content wildcard. Invalid, text content not allowed Schema defines default open content but not applying to an empty content model Defined by defaultOpenContent with appliesToEmpty=false. Valid, uses no open content. Invalid, open content is not allowed. Invalid, text content not allowed Invalid, even whitespace is not allowed Schema defines default open content not applying to an empty content model - but it does apply to a mixed content model with an empty particle Defined by defaultOpenContent with appliesToEmpty=false. Valid, uses open content. A valid restriction Base type has open content, restricted type does not Valid, no open content. Invalid, tries to use open content. A valid restriction Base type has open content, restricted type has identical open content Valid, uses open content. Invalid, tries to a child not defined in derived type. Open content: no effect on complex types with simple content Default open content ignored on a CT-with-SC Valid, no attempt to use open content. Invalid, tries to use an open content child, not allowed with simple content. An invalid restriction Restricted type has open content, base does not An invalid restriction Restricted type has more permissive wildcard than base An invalid restriction Restricted type has more permissive wildcard processContents than base An invalid restriction Restricted type allows interleaved open content, base only allows suffixed A valid restriction Base type has suffixed open content, restricted type has interleaved open content, but it's OK because the restricted type is otherwise empty. Valid, uses open content. A valid restriction Base type has suffixed open content, restricted type has interleaved open content, but it's OK because the restricted type is otherwise empty (well, "mixed empty"). Valid, uses open content. A valid restriction (though Saxon can't yet handle it) Base type has an explicit wildcard, restricted type has interleaved open content, all instances of the restricted type are valid against the base type. Valid, uses open content. A valid restriction Open content in base type allows more namespaces than open content in derived type Valid, uses open content. A valid restriction Open content in base type has weaker processContents than open content in derived type Valid, uses open content. Open content and regular content match the same instances Show that regular particles take precedence Valid, uses open content. Invalid, element i must be an integer. A valid extension Base type has suffix open content, extended type does not Valid, no open content. Valid, open content after extension content. Valid, open content at end, no extension content. Invalid, tries to use open content not at the end. A valid extension Derived type has suffix open content, base type does not Valid, no open content. Valid, open content after extension content. Valid, open content at end, no extension content. Invalid, tries to use open content not at the end. A valid extension complex type extension: derived type takes openContent from the default open content of the schema in preference to that of the base type. This makes the extension invalid. A valid extension complex type extension: derived type takes openContent from the base type ignoring the defaultOpenContent when the type is empty and default open content does not apply to empty Valid, no open content. Valid, open content after extension content. Valid, open content at end, no extension content. Valid, tries to use open content not at the end. Invalid, tries to use open content in the wrong namespace. An invalid extension Base type has interleaved open content, extension has suffix open content Valid content model Valid open content: it's not an error for open content to compete with ordinary wildcards Test defaultAttributesApply on an anonymous complex type Attribute is allowed on both named and unnamed types Valid, uses default attributes correctly. Invalid, defaultAttributesApply=false disallows id attribute on BookStore. Invalid, defaultAttributes do not apply to simple types. An invalid restriction Spec bug 7069 - openContent mode="none" with a wildcard child Two annotation children You're not allowed two annotation children, for some reason Two annotation children You're not allowed two opencontent elements with the same ID Two annotation children You're not allowed two opencontent elements with the same ID defaultOpenContent is scoped to a schema document defaultOpenContent does not apply to types included from a different schema document Valid, uses open content only where allowed. Invalid, uses open content on type beta where it is not applicable. defaultOpenContent is scoped to a schema document defaultOpenContent does not apply to types included from a different schema document Valid, uses open content only where allowed. Invalid, uses open content on type alpha where it is not applicable. defaultOpenContent applies to types defined within xs:redefine defaultOpenContent applies to types defined within xs:redefine Valid, uses open content only where allowed. Invalid, uses open content on type alpha where it is not applicable. Invalid, uses open content on type alpha with the permitted namespaces of the pre-redefinition type. For types defined within xs:override, the relevant defaultOpenContent is the one in the overridden schema document For types defined within xs:override, the relevant defaultOpenContent is the one in the overridden schema document. Test revised 2011-10-10 in response to bug 13458. Valid, uses no open content Invalid, uses open content on type alpha where it is not applicable. Invalid, uses open content on type beta where it is not applicable. defaultAttributes applies to types defined within xs:redefine defaultAttributes applies to types defined within xs:redefine Valid, uses default attributes only where allowed. Invalid, uses default attributes on type alpha where it is not applicable. Invalid, uses default attributes where it is not applicable. defaultAttributes does not apply to types defined within xs:override defaultAttributes does not apply to types defined within xs:override. Test rewritten 2011-10-10 to reflect the fact that for a complexType defined within xs:override, the defaultAttributes that apply are those defined within the overridden schema document, not the overriding schema document. Valid, uses no default attributes. Invalid, uses default attributes on type alpha where it is not applicable. Invalid, uses default attributes on type beta where it is not applicable. A valid extension complex type extension: derived type takes openContent from the base type ignoring the defaultOpenContent when the type is empty and default open content does not apply to empty. This test was formerly open031 and was believed to be valid; see bug 13459. A valid extension complex type extension: derived type's open content allows the union of the wildcards specified for the base type and for the extension. Valid, open content permitted by the base type. Valid, open content permitted by the extension. Valid, open content permitted by the extension. Invalid, open content violates dynamic EDC rule maxOccurs not allowed on xs:any within xs:openContent Was open042, unintended error reported in bug 15618 Valid content model Basic test of defaultAttributes Valid, uses default attributes. Valid, omits default attributes. Valid content model Basic test of defaultAttributes with defaultAttributesApply=false Valid, uses default attributes as appropriate. Invalid, uses default attributes where they don't apply. Unresolved reference Unresolved reference to default attribute group Unresolved reference Default attribute group in unimported namespace Valid content model defaultAttributes in an imported namespace Valid, uses default attributes as appropriate. Invalid, uses default attributes where they don't apply because the type is defined in a different schema document with no defaultAttributes