xs:annotation — Informative data for human or electronic agents.
<xs:annotation id = xs:ID {any attributes with non-schema namespace} > Content: (xs:appinfo | xs:documentation)* </xs:annotation>
May be included in: 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
xs:annotation
is a container in which additional
information can be embedded, either for human consumption (with
xs:documentation
) or for programs
(xs:appinfo
). xs:annotation
can
be added as a first element in almost any W3C XML Schema element. It
can also be included anywhere as a top-level element (directly under
xs:schema
).
<xs:element name="author" type="author"> <xs:annotation> <xs:documentation xml:lang="en"> The author of a book. </xs:documentation> <xs:documentation xml:lang="fr"> Designe l'auteur d'un livre. </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) or (dead > born)" diagnostics="bornAfterDead"> An author should die after her or his death. </sch:assert> <sch:diagnostics> <sch:diagnostic id="bornAfterDead"> Error, this author is born after her or his birth! Author= <sch:value-of select="name"/> Birth = <sch:value-of select="born"/> Death = <sch:value-of select="dead"/> </sch:diagnostic> </sch:diagnostics> </sch:rule> </sch:pattern> </xs:appinfo> </xs:annotation> </xs:element>