【发布时间】:2021-06-28 18:39:06
【问题描述】:
您能否将 XML Schema 类型的文档包含在元素的文档中?例如,对于下面的架构,FirstOption 元素的文档应该或多或少类似于:
Enable First Option?
Yes/No Choice
1 = Yes
0 = No
<?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>
【问题讨论】:
标签: xml xsd documentation