--- Begin Message ---
Package: nxml-mode
Version: 20041004-6
Severity: wishlist
Tags: patch
I use nxml-mode to edit XML Schemas. The nxml-mode package could support this
by including the attached RNC file (converted from the RNG at
http://www.jenitennison.com/schema/xmlschema.rng) as
/usr/share/emacs/site-lisp/nxml-mode/schemas/xmlschema.rnc , and adding the
following lines to /usr/share/emacs/site-lisp/nxml-mode/schema/schemas.xml:
<uri pattern="*.xsd" typeId="XML Schema"/>
<namespace ns="http://www.w3.org/2001/XMLSchema" typeId="XML Schema"/>
<documentElement localName="schema" typeId="XML Schema"/>
<typeId id="XML Schema" uri="xmlschema.rnc"/>
Thanks,
Josh Triplett
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.18-josh (PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages nxml-mode depends on:
ii emacs-snapshot-gtk [emacs-s 1:20070302-1 The GNU Emacs editor (with GTK+ 2.
ii emacs21 21.4a+1-5 The GNU Emacs editor
ii emacsen-common 1.4.17 Common facilities for all emacsen
nxml-mode recommends no packages.
-- no debconf information
default namespace xs = "http://www.w3.org/2001/XMLSchema"
namespace local = ""
namespace inh = inherit
namespace doc = "http://www.jenitennison.com/doc"
doc:p
[
"""
RELAX NG schema for XML Schema by """
doc:link [ href = "mailto:[email protected]" "Jeni Tennison" ]
""". Based on
"""
doc:link
[
href = "http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/"
"""XML
Schema Part I: Structures Recommendation"""
]
" and "
doc:link
[
href = "http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/"
"""XML Schema Part
II: Datatypes"""
]
""".
"""
]
doc:changes
[
date = "2001-11-24"
doc:p [ """
Amended to comply with 10 August 2001 Tutorial.
""" ]
doc:change [ "Removed key attributes." ]
doc:change [ "Replaced not element with except elements." ]
doc:change
[
"""
Replaced multiple consecutive optional attributes to use the
zeroOrMore/choice pattern.
"""
]
doc:change
[
"""
Removed interleave elements inside list elements (which are no longer
permitted).
"""
]
]
[
doc:p
[
"""
This allows any number of attributes that are not in the XML Schema
namespace or are in no namespace. This is somewhat more complicated than
the XML Schema anyAttribute equivalent.
"""
]
]
openAttrs = attribute * - (xs:* | local:* | xml:lang) { text }*
[
doc:p
[
"""
This allows any number of attributes that are not in the XML Schema
namespace or are in no namespace, an optional id attribute of type ID,
and an optional annotation element. This is used as the basis for many
element content models.
"""
]
]
annotated = openAttrs, attribute id { xsd:ID }?, annotation?
[
doc:p
[
"""
This gives the content model of the top level of the schema.
"""
]
]
schemaTop = redefinable | topLevelElement | topLevelAttribute | notation
[
doc:p
[
"""
This gives the components that can be redefined within the redefine
element. They also occur at the top level of the schema.
"""
]
]
redefinable =
topLevelSimpleType | topLevelComplexType | namedGroup | namedAttributeGroup
[
doc:p
[
"""
This gives the values for the various form attributes:
elementFormDefault and attributeFormDefault on the schema element, and
the form attributes on the element and attribute elements.
"""
]
]
formChoice = "qualified" | "unqualified"
[
doc:p
[
"""
This gives the values that can be taken in the lists used to control
derivation by extension or restriction (this is 'reduced' derivation
because some derivation can involve substitution). This RELAX NG schema,
like the XML Schema Recommendation here, allows the keywords 'extension'
and
'restriction' to be repeated any number of times.
"""
]
]
reducedDerivationControl = list { ( "extension" | "restriction" )* }
[
doc:p
[
"""
This specifies the possible values for attributes that control derivation.
"""
]
]
derivationSet = "#all" | reducedDerivationControl
[
doc:p
[
"""
This is the beginning point for the schema, and defines the schema
element.
"""
]
]
start =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-schema" ]
element schema
{
openAttrs,
(
attribute version { xsd:token }
| attribute finalDefault { derivationSet }
| attribute blockDefault { blockSet }
| attribute attributeFormDefault { formChoice }
| attribute elementFormDefault { formChoice }
| attribute id { xsd:ID }
| attribute xml:lang { xsd:language }
)*,
(
[
doc:p
[
"""
If a targetNamespace attribute is specified on the schema
element, then the namespace attribute on the import elements
that it contains are optional.
"""
]
]
(
attribute targetNamespace { xsd:anyURI },
( \include | importOptionalNamespace | redefine | annotation )*
)
| [
doc:p
[
"""
If a targetNamespace attribute is not specified on the schema
element, then the import elements that it contains must specify
a namespace.
"""
]
]
( \include | importRequiredNamespace | redefine | annotation )*
),
( schemaTop, annotation* )*
}
[
doc:p
[
"""
This gives the value type for the maxOccurs attribute, which may be a
non-negative number or the keyword 'unbounded'.
"""
]
]
allNNI = xsd:nonNegativeInteger | xsd:token "unbounded"
[
doc:p
[
"""
This specifies the occurs attributes, minOccurs and maxOccurs, as they
are normally used.
"""
]
]
occurs =
(
attribute minOccurs { xsd:nonNegativeInteger }
| attribute maxOccurs { allNNI }
)*
[ doc:p [ """
This gives the possible content of complex types.
""" ] ]
typeDefParticle = groupRef | all | choice | sequence
[
doc:p
[
"""
This gives the particles that can make up a model group.
"""
]
]
nestedParticle = localElement | groupRef | choice | sequence | any
[
doc:p
[
"""
This specifies the relationship between fixed and default attributes on
element and attribute elements - if one is present, then the other cannot
be. This is a constraint that cannot be specified using XML Schema.
"""
]
]
fixedOrDefault = empty | attribute fixed { text } | attribute default { text }
[
doc:p
[
"""
This specifies the relationship between the type attribute and the
simpleType element child of attribute elements - if one is present, then
the other cannot be, although it is possible for neither to be allowed.
"""
]
]
attributeType = empty | attribute type { xsd:QName } | localSimpleType
[
doc:p
[
"""
This describes attribute elements when used in a local context. They
have an optional use attribute, possibly a fixed or default attribute,
and then can either have a ref attribute (referring to a top-level
attribute) or a name attribute with an optional form attribute and
specifying an attribute type.
"""
]
]
localAttribute =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-attribute" ]
element attribute
{
annotated,
attribute use
{
xsd:token "optional" | xsd:token "prohibited" | xsd:token "required"
}?,
fixedOrDefault,
(
attribute ref { xsd:QName }
| (
attribute name { xsd:NCName },
attribute form { formChoice }?,
attributeType
)
)
}
[
doc:p
[
"""
This describes attribute elements when used at the top level of the
schema. They must have a name, may have a fixed or default attribute,
and specify their type through a type attribute or child simpleType
element. The name attribute of each attribute element that appears at
the top level of the schema is unique.
"""
]
]
topLevelAttribute =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-attribute" ]
element attribute
{
annotated,
attribute name { xsd:NCName },
fixedOrDefault,
attributeType
}
[
doc:p
[
"""
This gives the model group for specifying the attributes in a complex
type, an extension or restriction.
"""
]
]
attrDecls = ( localAttribute | attributeGroupRef )*, anyAttribute?
[ doc:p [ """
This specifies the anyAttribute wildcard.
""" ] ]
anyAttribute =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-anyAttribute" ]
element anyAttribute { wildcard }
[
doc:p
[
"""
This specifies the content of a complexType element. As children, it can
have a simpleContent, a complexContent or a model group. Only if it has
one of the latter two, may it have a mixed attribute. This latter
constraint is something that cannot be specified in XML Schema.
"""
]
]
complexTypeModel =
simpleContent
| (
attribute mixed { xsd:boolean }?,
( complexContent | ( typeDefParticle?, attrDecls ) )
)
[
doc:p
[
"""
This specifies the basic content of a complexType element.
"""
]
]
complexType = annotated, complexTypeModel
[
doc:p
[
"""
This specifies the model for a complexType element at the top level of
the schema. It must have a name, which provides a unique identifier
within the type symbol space. It may have abstract, block and/or final
attributes. Otherwise it is the same as other complexTypes.
"""
]
]
topLevelComplexType =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-complexType" ]
element complexType
{
complexType,
attribute name { xsd:NCName },
(
attribute abstract { xsd:boolean }
| attribute block { derivationSet }
| attribute final { derivationSet }
)*
}
[
doc:p
[
"""
This specifies the model for a local complexType element.
"""
]
]
localComplexType =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-complexType" ]
element complexType { complexType }
[
doc:p
[
"""
This describes a restriction element within a complexContent element
(i.e. one that restricts a complex type). It has a base attribute, may
contain a model group and may contain attribute declarations of various
sorts.
"""
]
]
complexRestriction =
[
doc:href =
"http://www.w3.org/TR/xmlschema-1/#element-complexContent::restriction"
]
element restriction
{
annotated,
attribute base { xsd:QName },
typeDefParticle?,
attrDecls
}
[
doc:p
[
"""
This specifies the basic model for an extension element: adding a
required base attribute to the model used for most components.
"""
]
]
extensionType = annotated, attribute base { xsd:QName }
[
doc:p
[
"""
This describes an extension element within a complexContent element
(i.e. one that restricts a complex type). It may contain a model group
and may contain attribute declarations of various sorts.
"""
]
]
complexExtension =
[
doc:href =
"http://www.w3.org/TR/xmlschema-1/#element-complexContent::extension"
]
element extension { extensionType, typeDefParticle?, attrDecls }
[
doc:p
[
"""
This describes a complexContent element. It may have a mixed attribute,
and either a restriction or extension element as content.
"""
]
]
complexContent =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-complexContent" ]
element complexContent
{
annotated,
attribute mixed { xsd:boolean }?,
( complexRestriction | complexExtension )
}
[
doc:p
[
"""
This describes a restriction element that appears within a simpleContent
or simpleType element (i.e. one that restricts a simple type). Its
content follows the simple restriction model that is detailed below, and
may include attribute declarations.
"""
]
]
simpleRestriction =
[
doc:href =
"http://www.w3.org/TR/xmlschema-1/#element-simpleContent::restriction"
]
element restriction { annotated, simpleRestrictionModel, attrDecls }
[
doc:p
[
"""
This describes an extension element that appears within a simpleContent
element (i.e. one that extends a simple type). Like other extensions, it
has a base type, but it can only be used to add attributes.
"""
]
]
simpleExtension =
[
doc:href =
"http://www.w3.org/TR/xmlschema-1/#element-simpleContent::extension"
]
element extension { extensionType, attrDecls }
[
doc:p
[
"""
This describes a simpleContent element, whose content can either hold a
restriction or extension element.
"""
]
]
simpleContent =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-simpleContent" ]
element simpleContent { annotated, ( simpleRestriction | simpleExtension ) }
[
doc:p
[
"""
This gives the possible values for block attributes on element elements,
which includes substitution amongst the list of possible values. This
RELAX NG schema, like the XML Schema Recommendation, allows each of the
keywords 'extension', 'restriction' and 'substitution' to occur more than
once within the list.
"""
]
]
blockSet =
xsd:token "#all"
| list { ( "extension" | "restriction" | "substitution" )* }
[
doc:p
[
"""
This describes the basic content model of an element element. It is
annotated, may have a fixed or default attribute, and may have nillable
and/or block attributes. Its type may be specified through a type
attribute, a local simple type or a local complex type - the choice
between these methods is something that cannot be indicated with XML
Schema. This content is optionally followed by some identify constraints.
"""
]
]
\element =
annotated,
fixedOrDefault,
( attribute nillable { xsd:boolean } | attribute block { blockSet } )*,
(
empty
| attribute type { xsd:QName }
| localSimpleType
| localComplexType
),
identityConstraint*
[
doc:p
[
"""
This describes an element element that appears at the top level of the
schema. On top of the basic content for an element element, it has to
have a name, which is a unique identifier in the element symbol space. It
may have substitutionGroup, abstract and/or final attributes.
"""
]
]
topLevelElement =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-element" ]
element element
{
\element,
attribute name { xsd:NCName },
(
attribute substitutionGroup { xsd:QName }
| attribute abstract { xsd:boolean }
| attribute final { derivationSet }
)*
}
[
doc:p
[
"""
This describes an element element that appears locally, within a
complexType or group element. It may have minOccurs and/or maxOccurs
attributes. If it has a ref attribute, then that's all it can
have. Otherwise, it must have a name and specifies its type in the same
way as the basic element content model described above. It may in this
case also have a form element. These constraints on local elements
cannot be described within XML Schema.
"""
]
]
localElement =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-element" ]
element element
{
occurs,
(
attribute ref { xsd:QName }
| (
\element,
attribute name { xsd:NCName },
attribute form { formChoice }?
)
)
}
[
doc:p
[
"""
This describes an group element that appears at the top level of the
schema. It must have a name attribute, and must have one of an all,
choice or sequence element child.
"""
]
]
namedGroup =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-group" ]
element group
{
annotated,
attribute name { xsd:NCName },
(
element all { allModel }
| element choice { simpleExplicitGroup }
| element sequence { simpleExplicitGroup }
)
}
[
doc:p
[
"""
This describes group element that occurs locally, referring to a
top-level named group. It may have occurrence attributes, and must have
a ref attribute.
"""
]
]
groupRef =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-group" ]
element group { annotated, occurs, attribute ref { xsd:QName } }
[
doc:p
[
"""
This gives the content of a model group (not a group element) in the
normal run of things. It has occurrence attributes and any number of
particles within it.
"""
]
]
explicitGroup = annotated, occurs, nestedParticle*
[
doc:p
[
"""
This gives the content of a model group (not a group element) within a
named group - it differs from the above in that it doesn't have any
occurrence attributes.
"""
]
]
simpleExplicitGroup = annotated, nestedParticle*
[
doc:p
[
"""
This gives the content of an all element. It contains element elements
that are similar to local element elements, but the minOccurs and
maxOccurs attributes can only take values of 0 or 1.
"""
]
]
allModel =
annotated,
element element
{
(
attribute minOccurs
{
xsd:nonNegativeInteger "0" | xsd:nonNegativeInteger "1"
}
| attribute maxOccurs
{
xsd:nonNegativeInteger "0" | xsd:nonNegativeInteger "1"
}
)*,
(
attribute ref { xsd:QName }
| (
\element,
attribute name { xsd:NCName },
attribute form { formChoice }?
)
)
}*
[
doc:p
[
"""
This describes an all element that appears outside a named group (i.e. as
the content of a complexType element). It has the standard model for an
all element, but adds minOccurs and maxOccurs attributes which can only
take certain values.
"""
]
]
all =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-all" ]
element all
{
allModel,
(
attribute minOccurs
{
xsd:nonNegativeInteger "0" | xsd:nonNegativeInteger "1"
}
| attribute maxOccurs { xsd:nonNegativeInteger "1" }
)*
}
[
doc:p
[
"""
This describes a choice element that appears outside a named group.
"""
]
]
choice =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-choice" ]
element choice { explicitGroup }
[
doc:p
[
"""
This describes a sequence element that appears outside a named group.
"""
]
]
sequence =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-sequence" ]
element sequence { explicitGroup }
[
doc:p
[
"""
This describes a wildcard element (i.e. any or anyAttribute). The
namespace attribute can take a list URIs interspersed with the keywords
'##targetNamespace' and/or '##local'. This RELAX NG schema, like the XML
Schema Recommendation, allows the keywords to be specified more than once
each within the list, if they're given. This model also specifies the
processContents attribute.
"""
]
]
wildcard =
annotated,
(
attribute namespace
{
xsd:token "##any"
| xsd:token "##other"
| list { ( xsd:anyURI | "##targetNamespace" | "##local" )* }
}
| attribute processContents
{
xsd:token "lax" | xsd:token "skip" | xsd:token "strict"
}
)*
[ doc:p [ """
This describes an any element as a wildcard.
""" ] ]
any =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-any" ]
element any { wildcard, occurs }
[
doc:p
[
"""
This describes an attributeGroup element as it appears at the top level
of the schema. It must have a name attribute, and then contains
attribute declarations.
"""
]
]
namedAttributeGroup =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-attributeGroup" ]
element attributeGroup
{
annotated,
attribute name { xsd:NCName },
attrDecls
}
[
doc:p
[
"""
This describes an attributeGroup element as it appears within a complex
type. It must have a ref attribute.
"""
]
]
attributeGroupRef =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-attributeGroup" ]
element attributeGroup { annotated, attribute ref { xsd:QName } }
[
doc:p
[
"""
This describes an include element, which must have a schemaLocation
attribute.
"""
]
]
\include =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-include" ]
element include { annotated, attribute schemaLocation { xsd:anyURI } }
[
doc:p
[
"""
This describes a redefine element, which must have a schemaLocation
attribute and can then contain any mix of annotations and redefinable
components.
"""
]
]
redefine =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-redefine" ]
element redefine
{
openAttrs,
attribute id { xsd:ID }?,
attribute schemaLocation { xsd:anyURI },
( annotation | redefinable )*
}
[
doc:p
[
"""
This gives the basic model for an import element - an optional
schemaLocation attribute.
"""
]
]
import = annotated, attribute schemaLocation { xsd:anyURI }?
[
doc:p
[
"""
This describes an import element that's used when its parent schema
element doesn't specify a targetNamespace. In these cases, the
import element must give a namespace attribute.
"""
]
]
importRequiredNamespace =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-import" ]
element import { import, attribute namespace { xsd:anyURI } }
[
doc:p
[
"""
This describes an import element that's used when its parent schema
element specifies a targetNamespace. In these cases, the namespace
attribute on the import element is optional.
"""
]
]
importOptionalNamespace =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-import" ]
element import { import, attribute namespace { xsd:anyURI }? }
[
doc:p
[
"""
This describes a selector element. The xpath attribute is a simplified
XPath - the regular expression given here is the one from the XML Schema
for XML Schema.
"""
]
]
selector =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-selector" ]
element selector
{
annotated,
attribute xpath
{
xsd:token
{
pattern =
"(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*"
}
}
}
[
doc:p
[
"""
This describes a field element. The xpath attribute is a simplified
XPath - the regular expression given here is the one from the XML Schema
for XML Schema.
"""
]
]
field =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-field" ]
element field
{
annotated,
attribute xpath
{
xsd:token
{
pattern =
"(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*"
}
}
}
[
doc:p
[
"""
This gives the basic content for identity constraints - a name attribute
that uniquely identifies the identity constraint, a selector element and
one or more field elements.
"""
]
]
keybase = annotated, attribute name { xsd:NCName }, selector, field+
[
doc:p
[
"""
This gives a model group for the three identity constraint elements, used
within the content of element elements.
"""
]
]
identityConstraint = unique | key | keyref
[ doc:p [ """
This describes a unique element.
""" ] ]
unique =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-unique" ]
element unique { keybase }
[ doc:p [ """
This describes a key element.
""" ] ]
key =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-key" ]
element key { keybase }
[ doc:p [ """
This describes a keyref element.
""" ] ]
keyref =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-keyref" ]
element keyref { keybase, attribute refer { xsd:QName } }
[
doc:p
[
"""
This describes a notation element. The names of notation elements are
unique in the notation symbol space. The public attribute is required,
and the system attribute is optional.
"""
]
]
notation =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-notation" ]
element notation
{
annotated,
attribute name { xsd:NCName },
attribute public { xsd:token },
attribute system { xsd:anyURI }?
}
[
doc:p
[
"""
This is designed to describe the content of the appinfo elements in the
schema. At the moment this allows any mixed content without validation.
Note that this is fairly complex compared to the XML Schema equivalent,
which would be a single any element.
"""
]
]
appinfoContent = anyContent
anyContent = mixed { element * { attribute * { text }*, anyContent, empty }* }
[
doc:p
[
"""
This describes an appinfo element. It has an optional source attribute
and can currently contain anything at all.
"""
]
]
appinfo =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-appinfo" ]
element appinfo { attribute source { xsd:anyURI }?, appinfoContent }
[
doc:p
[
"""
This is designed to describe the content of the documentation elements in
the schema. At the moment this allows any mixed content without
validation. Note that this is fairly complex compared to the XML Schema
equivalent, which would be a single any element.
"""
]
]
documentationContent = anyContent
[
doc:p
[
"""
This describes a documentation element. It has optional source
and xml:lang attributes and can currently contain anything at all.
"""
]
]
documentation =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-documentation" ]
element documentation
{
( attribute source { xsd:anyURI } | attribute xml:lang { xsd:language }
)*,
documentationContent
}
[
doc:p
[
"""
This describes an annotation element. It can have any attributes, may
have an id attribute, and contains any number of documentation or appinfo
elements.
"""
]
]
annotation =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-annotation" ]
element annotation
{
openAttrs,
attribute id { xsd:ID }?,
( documentation | appinfo )*
}
[
doc:p
[
"""
This gives the various types of derivation of simple types.
"""
]
]
simpleDerivation = simpleRestriction | \list | union
[
doc:p
[
"""
This specifies the values of the final attribute for simple types. This
RELAX NG schema for XML Schema, like the XML Schema Recommendation, allows
the keywords 'list', 'union' and 'restriction' to appear more than once
within the list.
"""
]
]
simpleDerivationSet =
xsd:token "#all" | list { ( "list" | "union" | "restriction" )* }
[ doc:p [ """
This gives the basic content of a simple type.
""" ] ]
simpleType = annotated, simpleDerivation
[
doc:p
[
"""
This describes a simpleType element as it appears at the top level of the
schema. It has to have a name attribute and may have a final attribute.
"""
]
]
topLevelSimpleType =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-simpleType" ]
element simpleType
{
simpleType,
attribute name { xsd:NCName },
attribute final { simpleDerivationSet }?
}
[
doc:p
[
"""
This describes a simpleType element as it appears within an attribute or
element.
"""
]
]
localSimpleType =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-simpleType" ]
element simpleType { simpleType }
[
doc:p
[
"""
This describes the relationship between the various range facets. Only
one of minExclusive and minInclusive can be present, and only one of
maxExclusive and maxInclusive can be present. This is a constraint that
can't easily be expressed using XML Schema. This RELAX NG schema
for XML Schema is a little more restrictive than the XML Schema
Recommendation in that it also forces there to be a maximum of one of
each of these types of facets.
"""
]
]
rangeFacets =
( minExclusive | minInclusive )? & ( maxExclusive | maxInclusive )?
[
doc:p
[
"""
This specifies optional totalDigits and fractionDigits elements. This
RELAX NG schema for XML Schema is a little more restrictive than the XML
Schema Recommendation in that it also forces there to be a maximum of one
of each of these types of facets.
"""
]
]
digitFacets = totalDigits?, fractionDigits?
[
doc:p
[
"""
This specifies optional length, minLength and maxLength elements. This
RELAX NG schema for XML Schema is a little more restrictive than the XML
Schema Recommendation in that it also forces there to be a maximum of one
of each of these types of facets, and says that if a length element is
given, then neither minLength nor maxLength should be present.
"""
]
]
lengthFacets = length | ( minLength? & maxLength? )
[
doc:p
[
"""
This specifies zero or more enumeration or pattern elements and an
optional whiteSpace element. This RELAX NG schema for XML Schema is a
little more restrictive than the XML Schema Recommendation in that it
also forces there to be a maximum of one whiteSpace element within the
facets. Note that the whiteSpace facet is constrained to have a value of
'collapse'.
"""
]
]
commonFacets = enumeration*, whiteSpaceCollapse?, pattern*
[
doc:p
[
"""
This specifies the types of facets that are valid in restrictions on the
built-in data types. This can only perform rudimentary checking, but
should be enough in most circumstances. Note that for xs:anySimpleType
and xs:string, the whiteSpace facet can take any value, for
xs:normalizedString it can be 'replace' or 'collapse', and for all other
built-in types it has to be 'collapse'.
"""
]
]
simpleRestrictionModel =
(
attribute base { xsd:QName "xs:anySimpleType" },
(
rangeFacets
& digitFacets
& lengthFacets
& whiteSpace?
& enumeration*
& pattern*
)
)
| (
attribute base { xsd:QName "xs:string" },
( lengthFacets & whiteSpace? & enumeration* & pattern* )
)
| (
attribute base { xsd:QName "xs:normalizedString" },
( lengthFacets & whiteSpaceReplaceOrCollapse? & enumeration* & pattern* )
)
| (
attribute base
{
xsd:QName "xs:token"
| xsd:QName "xs:language"
| xsd:QName "xs:Name"
| xsd:QName "xs:NCName"
| xsd:QName "xs:ID"
| xsd:QName "xs:IDREF"
| xsd:QName "xs:IDREFS"
| xsd:QName "xs:NMTOKEN"
| xsd:QName "xs:NMTOKENS"
| xsd:QName "xs:ENTITY"
| xsd:QName "xs:ENTITIES"
| xsd:QName "xs:hexBinary"
| xsd:QName "xs:base64Binary"
| xsd:QName "xs:anyURI"
| xsd:QName "xs:QName"
| xsd:QName "xs:NOTATION"
},
( lengthFacets & commonFacets )
)
| (
attribute base { xsd:QName "xs:boolean" },
( whiteSpaceCollapse? & pattern* )
)
| (
attribute base
{
xsd:QName "xs:decimal"
| xsd:QName "xs:integer"
| xsd:QName "xs:nonPositiveInteger"
| xsd:QName "xs:nonNegativeInteger"
| xsd:QName "xs:positiveInteger"
| xsd:QName "xs:negativeInteger"
| xsd:QName "xs:unsignedLong"
| xsd:QName "xs:unsignedInt"
| xsd:QName "xs:unsignedShort"
| xsd:QName "xs:unsignedByte"
| xsd:QName "xs:long"
| xsd:QName "xs:int"
| xsd:QName "xs:short"
| xsd:QName "xs:byte"
},
( digitFacets & rangeFacets & commonFacets )
)
| (
attribute base
{
xsd:QName "xs:float"
| xsd:QName "xs:double"
| xsd:QName "xs:duration"
| xsd:QName "xs:dateTime"
| xsd:QName "xs:time"
| xsd:QName "xs:date"
| xsd:QName "xs:gYearMonth"
| xsd:QName "xs:gYear"
| xsd:QName "xs:gMonthDay"
| xsd:QName "xs:gMonth"
| xsd:QName "xs:gDay"
},
( rangeFacets & commonFacets )
)
| (
( attribute base { xsd:QName } | localSimpleType ),
(
rangeFacets
& digitFacets
& lengthFacets
& whiteSpace?
& enumeration*
& pattern*
)
)
[
doc:p
[
"""
This describes a list element. It can either specify a local simple type
or have a itemType attribute. This constraint cannot be expressed in XML
Schema.
"""
]
]
\list =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-list" ]
element list
{
annotated,
( localSimpleType | attribute itemType { xsd:QName } )
}
[
doc:p
[
"""
This describes a union element. If the memberTypes attribute is missing
or empty, then it must contain one or more simpleType elements; if
it's present, then it can contain simpleType elements or list simple
types in the memberTypes attribute. This constraint cannot be expressed
in XML Schema.
"""
]
]
union =
[ doc:href = "http://www.w3.org/TR/xmlschema-1/#element-union" ]
element union
{
annotated,
(
( attribute memberTypes { list { xsd:QName+ } }, localSimpleType* )
| ( attribute memberTypes { empty }?, localSimpleType+ )
)
}
[
doc:p
[
"""
This is the basic content of a facet. It has an optional fixed attribute.
"""
]
]
facet = annotated, attribute fixed { xsd:boolean }?
[
doc:p
[
"""
This is the content of a facet that cannot be fixed (enumeration or
pattern). It has a value attribute that can take any kind of value.
"""
]
]
noFixedFacet = annotated, attribute value { text }
[
doc:p
[
"""
This is the content of a range facet. The value must be one of the data
types shown (as these are the only types of data that accept ranges). I
haven't gone so far as to indicate the data type of the value
attribute of a range facet according to the base type as this would be
very complicated (although it would be possible in RELAX NG).
"""
]
]
rangeFacet =
facet,
attribute value
{
xsd:decimal
| xsd:float
| xsd:double
| xsd:duration
| xsd:dateTime
| xsd:time
| xsd:date
| xsd:gYearMonth
| xsd:gYear
| xsd:gMonthDay
| xsd:gMonth
| xsd:gDay
}
[ doc:p [ """
This describes a minExclusive element.
""" ] ]
minExclusive =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-minExclusive"
]
element minExclusive { rangeFacet }
[ doc:p [ """
This describes a minInclusive element.
""" ] ]
minInclusive =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-minInclusive"
]
element minInclusive { rangeFacet }
[ doc:p [ """
This describes a maxExclusive element.
""" ] ]
maxExclusive =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-maxExclusive"
]
element maxExclusive { rangeFacet }
[ doc:p [ """
This describes a maxInclusive element.
""" ] ]
maxInclusive =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-maxInclusive"
]
element maxInclusive { rangeFacet }
[ doc:p [ """
This is the content of a numerical facet.
""" ] ]
numFacet = facet, attribute value { xsd:nonNegativeInteger }
[
doc:p
[
"""
This describes a totalDigits element. The value attribute must take a
positive integer.
"""
]
]
totalDigits =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-totalDigits"
]
element totalDigits { facet, attribute value { xsd:positiveInteger } }
[ doc:p [ """
This describes a fractionDigits element.
""" ] ]
fractionDigits =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-fractionDigits"
]
element fractionDigits { numFacet }
[ doc:p [ """
This describes a length element.
""" ] ]
length =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-length"
]
element length { numFacet }
[ doc:p [ """
This describes a minLength element.
""" ] ]
minLength =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-minLength"
]
element minLength { numFacet }
[ doc:p [ """
This describes a maxLength element.
""" ] ]
maxLength =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-maxLength"
]
element maxLength { numFacet }
[ doc:p [ """
This describes an enumeration element.
""" ] ]
enumeration =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-enumeration"
]
element enumeration { noFixedFacet }
[
doc:p
[
"""
This describes a whiteSpace element that can take any of the permitted
values.
"""
]
]
whiteSpace =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-whiteSpace"
]
element whiteSpace
{
facet,
attribute value
{
xsd:token "preserve" | xsd:token "replace" | xsd:token "collapse"
}
}
[
doc:p
[
"""
This describes a whiteSpace element that can only take the values
'replace' or 'collapse'.
"""
]
]
whiteSpaceReplaceOrCollapse =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-whiteSpace"
]
element whiteSpace
{
facet,
attribute value { xsd:token "replace" | xsd:token "collapse" }
}
[
doc:p
[
"""
This describes a whiteSpace element that can only take the value
'collapse'.
"""
]
]
whiteSpaceCollapse =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-whiteSpace"
]
element whiteSpace { facet, attribute value { xsd:token "collapse" } }
[ doc:p [ """
This describes a pattern element.
""" ] ]
pattern =
[
doc:href =
"http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-pattern"
]
element pattern { noFixedFacet }
--- End Message ---