是否将元素类型的文档包含到XML模式元素中?

是否将元素类型的文档包含到XML模式元素中?,xml,xsd,documentation,Xml,Xsd,Documentation,能否将XML模式类型的文档包含到元素的文档中?例如,对于下面的模式,FirstOption元素的文档应该或多或少类似于: Enable First Option? Yes/No Choice 1 = Yes 0 = No 是/否选择 对 不 启用第一个选项? 不,没有基于XSD的标准方法来自动从另一个组件的文档或结构中包含或派生组件的文档 可能会考虑编写XSLT以从XSD生成文档,但是考虑到所涉及的复杂性,在一般情况下这样做的好处可能是有限的。1 另请参见: 1我用XSLT构建

能否将XML模式类型的文档包含到元素的文档中?例如,对于下面的模式,
FirstOption
元素的文档应该或多或少类似于:

Enable First Option?

Yes/No Choice
1 = Yes
0 = No

是/否选择
对
不
启用第一个选项?

不,没有基于XSD的标准方法来自动从另一个组件的文档或结构中包含或派生组件的文档

  • 可能会考虑编写XSLT以从XSD生成文档,但是考虑到所涉及的复杂性,在一般情况下这样做的好处可能是有限的。1
另请参见:

1我用XSLT构建了一个自动化文档系统,它记录了另一个用XSLT编写的系统,但手写文档更为常见

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:simpleType name="MyChoice">
    <xs:annotation>
      <xs:documentation>Yes/No Choice</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="1">
        <xs:annotation><xs:documentation>Yes</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="0">
        <xs:annotation>
          <xs:documentation>No</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="Options" >
    <xs:complexType>
      <xs:sequence>
        <xs:element name="FirstOption" type="MyChoice">
          <xs:annotation>
            <xs:documentation>Enable First Option?</xs:documentation>
            <!-- What to write here, to include the documentation of `MyChoice`? -->
          </xs:annotation>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>