XML/XSD-添加描述

XML/XSD-添加描述,xml,xsd,documentation,editor,Xml,Xsd,Documentation,Editor,有了XSD,我可以确保XML文件是有效的,但是还有一种方法,使用XSD,要将信息附加到元素和属性,以便打开XML和XSD文件的软件能够在用户单击所描述的元素时向用户显示该描述?您正在描述XSD:documentation元素 xsd:documentation和xsd:appinfo都可以包含在xsd:annotation元素中: 使用xsd:documentation向用户提供元信息 使用xsd:appinfo向应用程序提供元信息 对注释进行了介绍,其中提供了如何使用xsd:documen

有了XSD,我可以确保XML文件是有效的,但是还有一种方法,使用XSD,要将信息附加到元素和属性,以便打开XML和XSD文件的软件能够在用户单击所描述的元素时向用户显示该描述?

您正在描述
XSD:documentation
元素

xsd:documentation
xsd:appinfo
都可以包含在
xsd:annotation
元素中:

  • 使用
    xsd:documentation
    用户提供元信息
  • 使用
    xsd:appinfo
    应用程序提供元信息
对注释进行了介绍,其中提供了如何使用
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>

元素声明为匿名类型
具有2个属性的空匿名类型

您可能正在查找该元素。但当然,要确定是否有特定的编辑器使用了此信息,您需要查看该特定编辑器的文档。