aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: RELAX NG schema for XML Schema by Jeni Tennison. Based on aoqi@0: XML aoqi@0: Schema Part I: Structures Recommendation and XML Schema Part aoqi@0: II: Datatypes. aoqi@0: aoqi@0: aoqi@0: aoqi@0: Amended to comply with 10 August 2001 Tutorial. aoqi@0: aoqi@0: Removed key attributes. aoqi@0: Replaced not element with except elements. aoqi@0: aoqi@0: Replaced multiple consecutive optional attributes to use the aoqi@0: zeroOrMore/choice pattern. aoqi@0: aoqi@0: aoqi@0: Removed interleave elements inside list elements (which are no longer aoqi@0: permitted). aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This allows any number of attributes that are not in the XML Schema aoqi@0: namespace or are in no namespace. This is somewhat more complicated than aoqi@0: the XML Schema anyAttribute equivalent. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This allows any number of attributes that are not in the XML Schema aoqi@0: namespace or are in no namespace, an optional id attribute of type ID, aoqi@0: and an optional annotation element. This is used as the basis for many aoqi@0: element content models. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the content model of the top level of the schema. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the components that can be redefined within the redefine aoqi@0: element. They also occur at the top level of the schema. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the values for the various form attributes: aoqi@0: elementFormDefault and attributeFormDefault on the schema element, and aoqi@0: the form attributes on the element and attribute elements. aoqi@0: aoqi@0: aoqi@0: qualified aoqi@0: unqualified aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the values that can be taken in the lists used to control aoqi@0: derivation by extension or restriction (this is 'reduced' derivation aoqi@0: because some derivation can involve substitution). This RELAX NG schema, aoqi@0: like the XML Schema Recommendation here, allows the keywords 'extension' and aoqi@0: 'restriction' to be repeated any number of times. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: extension aoqi@0: restriction aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This specifies the possible values for attributes that control derivation. aoqi@0: aoqi@0: aoqi@0: #all aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This is the beginning point for the schema, and defines the schema aoqi@0: element. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the value type for the maxOccurs attribute, which may be a aoqi@0: non-negative number or the keyword 'unbounded'. aoqi@0: aoqi@0: aoqi@0: aoqi@0: unbounded aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This specifies the occurs attributes, minOccurs and maxOccurs, as they aoqi@0: are normally used. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the possible content of complex types. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the particles that can make up a model group. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This specifies the relationship between fixed and default attributes on aoqi@0: element and attribute elements - if one is present, then the other cannot aoqi@0: be. This is a constraint that cannot be specified using XML Schema. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This specifies the relationship between the type attribute and the aoqi@0: simpleType element child of attribute elements - if one is present, then aoqi@0: the other cannot be, although it is possible for neither to be allowed. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes attribute elements when used in a local context. They aoqi@0: have an optional use attribute, possibly a fixed or default attribute, aoqi@0: and then can either have a ref attribute (referring to a top-level aoqi@0: attribute) or a name attribute with an optional form attribute and aoqi@0: specifying an attribute type. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: optional aoqi@0: prohibited aoqi@0: required aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes attribute elements when used at the top level of the aoqi@0: schema. They must have a name, may have a fixed or default attribute, aoqi@0: and specify their type through a type attribute or child simpleType aoqi@0: element. The name attribute of each attribute element that appears at aoqi@0: the top level of the schema is unique. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the model group for specifying the attributes in a complex aoqi@0: type, an extension or restriction. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This specifies the anyAttribute wildcard. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This specifies the content of a complexType element. As children, it can aoqi@0: have a simpleContent, a complexContent or a model group. Only if it has aoqi@0: one of the latter two, may it have a mixed attribute. This latter aoqi@0: constraint is something that cannot be specified in XML Schema. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This specifies the basic content of a complexType element. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes a restriction element within a complexContent element aoqi@0: (i.e. one that restricts a complex type). It has a base attribute, may aoqi@0: contain a model group and may contain attribute declarations of various aoqi@0: sorts. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This specifies the basic model for an extension element: adding a aoqi@0: required base attribute to the model used for most components. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes an extension element within a complexContent element aoqi@0: (i.e. one that restricts a complex type). It may contain a model group aoqi@0: and may contain attribute declarations of various sorts. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes a complexContent element. It may have a mixed attribute, aoqi@0: and either a restriction or extension element as content. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes a restriction element that appears within a simpleContent aoqi@0: or simpleType element (i.e. one that restricts a simple type). Its aoqi@0: content follows the simple restriction model that is detailed below, and aoqi@0: may include attribute declarations. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes an extension element that appears within a simpleContent aoqi@0: element (i.e. one that extends a simple type). Like other extensions, it aoqi@0: has a base type, but it can only be used to add attributes. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes a simpleContent element, whose content can either hold a aoqi@0: restriction or extension element. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the possible values for block attributes on element elements, aoqi@0: which includes substitution amongst the list of possible values. This aoqi@0: RELAX NG schema, like the XML Schema Recommendation, allows each of the aoqi@0: keywords 'extension', 'restriction' and 'substitution' to occur more than aoqi@0: once within the list. aoqi@0: aoqi@0: aoqi@0: #all aoqi@0: aoqi@0: aoqi@0: aoqi@0: extension aoqi@0: restriction aoqi@0: substitution aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes the basic content model of an element element. It is aoqi@0: annotated, may have a fixed or default attribute, and may have nillable aoqi@0: and/or block attributes. Its type may be specified through a type aoqi@0: attribute, a local simple type or a local complex type - the choice aoqi@0: between these methods is something that cannot be indicated with XML aoqi@0: Schema. This content is optionally followed by some identify constraints. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes an element element that appears at the top level of the aoqi@0: schema. On top of the basic content for an element element, it has to aoqi@0: have a name, which is a unique identifier in the element symbol space. It aoqi@0: may have substitutionGroup, abstract and/or final attributes. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes an element element that appears locally, within a aoqi@0: complexType or group element. It may have minOccurs and/or maxOccurs aoqi@0: attributes. If it has a ref attribute, then that's all it can aoqi@0: have. Otherwise, it must have a name and specifies its type in the same aoqi@0: way as the basic element content model described above. It may in this aoqi@0: case also have a form element. These constraints on local elements aoqi@0: cannot be described within XML Schema. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the content of a model group (not a group element) in the aoqi@0: normal run of things. It has occurrence attributes and any number of aoqi@0: particles within it. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the content of a model group (not a group element) within a aoqi@0: named group - it differs from the above in that it doesn't have any aoqi@0: occurrence attributes. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes an all element that appears outside a named group (i.e. as aoqi@0: the content of a complexType element). It has the standard model for an aoqi@0: all element, but adds minOccurs and maxOccurs attributes which can only aoqi@0: take certain values. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes a choice element that appears outside a named group. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes a sequence element that appears outside a named group. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes a wildcard element (i.e. any or anyAttribute). The aoqi@0: namespace attribute can take a list URIs interspersed with the keywords aoqi@0: '##targetNamespace' and/or '##local'. This RELAX NG schema, like the XML aoqi@0: Schema Recommendation, allows the keywords to be specified more than once aoqi@0: each within the list, if they're given. This model also specifies the aoqi@0: processContents attribute. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: ##any aoqi@0: ##other aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: ##targetNamespace aoqi@0: ##local aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: lax aoqi@0: skip aoqi@0: strict aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes an any element as a wildcard. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes an import element that's used when its parent schema aoqi@0: element specifies a targetNamespace. In these cases, the namespace aoqi@0: attribute on the import element is optional. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This is designed to describe the content of the appinfo elements in the aoqi@0: schema. At the moment this allows any mixed content without validation. aoqi@0: Note that this is fairly complex compared to the XML Schema equivalent, aoqi@0: which would be a single any element. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes an appinfo element. It has an optional source attribute aoqi@0: and can currently contain anything at all. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This is designed to describe the content of the documentation elements in aoqi@0: the schema. At the moment this allows any mixed content without aoqi@0: validation. Note that this is fairly complex compared to the XML Schema aoqi@0: equivalent, which would be a single any element. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes a documentation element. It has optional source aoqi@0: and xml:lang attributes and can currently contain anything at all. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes an annotation element. It can have any attributes, may aoqi@0: have an id attribute, and contains any number of documentation or appinfo aoqi@0: elements. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the various types of derivation of simple types. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This specifies the values of the final attribute for simple types. This aoqi@0: RELAX NG schema for XML Schema, like the XML Schema Recommendation, allows aoqi@0: the keywords 'list', 'union' and 'restriction' to appear more than once aoqi@0: within the list. aoqi@0: aoqi@0: aoqi@0: #all aoqi@0: aoqi@0: aoqi@0: aoqi@0: list aoqi@0: union aoqi@0: restriction aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This gives the basic content of a simple type. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This specifies the types of facets that are valid in restrictions on the aoqi@0: built-in data types. This can only perform rudimentary checking, but aoqi@0: should be enough in most circumstances. Note that for xs:anySimpleType aoqi@0: and xs:string, the whiteSpace facet can take any value, for aoqi@0: xs:normalizedString it can be 'replace' or 'collapse', and for all other aoqi@0: built-in types it has to be 'collapse'. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes a list element. It can either specify a local simple type aoqi@0: or have a itemType attribute. This constraint cannot be expressed in XML aoqi@0: Schema. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes a union element. If the memberTypes attribute is missing aoqi@0: or empty, then it must contain one or more simpleType elements; if aoqi@0: it's present, then it can contain simpleType elements or list simple aoqi@0: types in the memberTypes attribute. This constraint cannot be expressed aoqi@0: in XML Schema. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This is the basic content of a facet. It has an optional fixed attribute. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This is the content of a facet that cannot be fixed (enumeration or aoqi@0: pattern). It has a value attribute that can take any kind of value. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: This describes an enumeration element. aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: aoqi@0: