Reputation: 8315
With XSD I can make sure that an XML file is valid, but is there also a way, using XSD, to attach informations to elements and properties so that a software that would open the XML and XSD file would be able to display that description to the user when he clicks on the element being described?
Upvotes: 5
Views: 7364
Reputation: 111491
You're describing the xsd:documentation
element.
Both xsd:documentation
and xsd:appinfo
can be included within an xsd:annotation
element:
xsd:documentation
to provide meta information to a user.xsd:appinfo
to provide meta information to a application.The W3C XML Schema Part 0: Primer Second Edition has an introduction to annotations here, where they provide the following example of how to use xsd:documentation
:
<xsd:element name="internationalPrice">
<xsd:annotation>
<xsd:documentation xml:lang="en">
element declared with anonymous type
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:annotation>
<xsd:documentation xml:lang="en">
empty anonymous type with 2 attributes
</xsd:documentation>
</xsd:annotation>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:attribute name="currency" type="xsd:string"/>
<xsd:attribute name="value" type="xsd:decimal"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
Upvotes: 9