XML technologies / XML Schema / XML Schema element reference / xs:annotation

(Excerpt from “XML Schema” by Eric van der Vlist)

Informative content for human or electronic agents.

<xs:annotation
    id = xs:ID
    {beliebige Attribute mit einem Nicht-Schema-Namensraum}
    >
    Content: (xs:appinfo | xs:documentation)*
</xs:annotation>

May occur within: xs:all (outside a group), xs:all (within a group), xs:any, xs:anyAttribute, xs:attribute (reference or local definition), xs:attribute (global definition), xs:attributeGroup (reference), xs:attributeGroup (global definition), xs:choice (outside a group), xs:choice (within a group), xs:complexContent, xs:complexType (local definition), xs:complexType (global definition), xs:element (within xs:all), xs:element (reference or local definition), xs:element (global definition), xs:enumeration, xs:extension (complex content), xs:extension (simple content), xs:field, xs:fractionDigits, xs:group (reference), xs:group (definition), xs:import, xs:include, xs:key, xs:keyref, xs:length, xs:list, xs:maxExclusive, xs:maxInclusive, xs:maxLength, xs:minExclusive, xs:minInclusive, xs:minLength, xs:notation, xs:pattern, xs:redefine, xs:restriction (complex content), xs:restriction (simple type), xs:restriction (simple content), xs:schema, xs:selector, xs:sequence (within a group), xs:sequence (outside a group), xs:simpleContent, xs:simpleType (local definition), xs:simpleType (global definition), xs:totalDigits, xs:union, xs:unique, xs:whitespace

Description

xs:annotation is a container for additional information intended for people, using xs:documentation, or programs, using xs:appinfo. xs:annotation can be added as the first child of almost any W3C XML element. It can also occur anywhere at the top level, directly within xs:schema.

Restrictions

xs:annotation cannot occur within itself.

Example

<xs:element name="author" type="author">
    <xs:annotation>
        <xs:documentation xml:lang="en">The author of a book.</xs:documentation>
        <xs:documentation xml:lang="de">Der Autor eines Buches.</xs:documentation>
        <xs:appinfo xmlns:sch="http://www.ascc.net/xml/schematron">
            <sch:pattern name="Born before dead">
                <sch:rule context="author">
                    <sch:assert test="not(dead) oder (dead &gt; born)" xs:any diagnostics="bornAfterDead">Ein Autor sollte erst nach seiner Geburt sterben.</sch:assert>
                    <sch:diagnostics>
                        <sch:diagnostic id="bornAfterDead">Fehler, dieser Autor wurde erst nach seinem Tod geboren! Autor = <sch:value-of select="name"/> Geburt = <sch:value-of select="born"/> Tod = <sch:value-of select="dead"/></sch:diagnostic>
                    </sch:diagnostics>
                </sch:rule>
            </sch:pattern>
        </xs:appinfo>
    </xs:annotation>
</xs:element>

Attributes

id
Element ID according to W3C XML Schema.

   

 

 

 

back to top