XML technologies / XML Schema / XML Schema element reference / xs:attribute (reference or local definition)
(Excerpt from “XML Schema” by Eric van der Vlist)
Reference to a global attribute definition or a local definition; local definitions cannot be referenced.
<xs:attribute
default = xs:string
fixed = xs:string
form = ( "qualified" | "unqualified" )
id = xs:ID
name = xs:NCName
ref = xs:QName
type = xs:QName
use = ( "prohibited" | "optional" | "required" ) : "optional"
{beliebige Attribute mit einem Nicht-Schema-Namensraum}
>
Content: ((xs:annotation?), (xs:simpleType?))
</xs:attribute>May occur within: xs:attributeGroup (global definition), xs:complexType (local definition), xs:complexType (global definition), xs:extension (complex content), xs:extension (simple content), xs:restriction (complex content), xs:restriction (simple content)
Description
This element serves two mutually exclusive purposes with different content models: a reference to a global attribute or a local attribute definition.
When referencing an attribute, attribute ref must contain its qualified name, including namespace prefix.
A local definition assigns the attribute a simple data type. This can use a reference through attribute type, referencing a simple type by qualified name, or inline by embedding its definition, element xs:simpleType, within element xs:attribute.
Restrictions
Locally defined attributes cannot be referenced.
Example
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute ref="lang"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
.../...
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="lang" type="xs:language"/>
</xs:extension>
</xs:simpleContent>Attributes
default
Default value. If present, the processor adds a missing attribute to the instance document with this value. Attributes default and fixed are mutually exclusive.
fixed
If present, the attribute’s value is fixed and must equal this value. Attributes default and fixed are mutually exclusive.
form
Specifies whether the attribute is qualified, requiring a namespace prefix in the instance document. Its default is specified by attribute attributeFormDefault of document element xs:schema, for local definitions only.
id
Element ID according to W3C XML Schema.
name
Local name without namespace prefix; local definitions only.
ref
Qualified name of a global attribute; references only.
type
Qualified name of a simple data type; definitions only.
use
Possible attribute use. Marking it “prohibited” is useful for excluding it during restriction.
Copyright © 2003 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “XML Schema” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de