我想向 XSD 子元素添加注釋檔案:
例如:
<xsd:complexType name="XY">
<xsd:sequence>
<xsd:element type="xType" name="x"/>
<xsd:annotation>
<xsd:documentation> I want to add a description here.
</xsd:documentation>
</xsd:annotation>
<xsd:element type="yType" name="y"/>
</xsd:sequence>
<xsd:attribute type="xsd:string" name="NAME" use="required"/>
</xsd:complexType>
顯然不起作用。
有沒有辦法明確定義子元素的檔案
uj5u.com熱心網友回復:
不要告訴我們它不起作用,告訴我們它是如何失敗的!
我看不出您的代碼應該失敗的任何原因(更不用說任何“明顯”的原因)。當然,它包含對未宣告型別的參考。下面的例子作業得很好:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="X">
<xs:complexType>
<xs:sequence>
<xs:element name="a" type="xs:string">
<xs:annotation>
<xs:documentation>Great!</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:assert test="matches(a, '^(hello|world)$', 'm')"/>
</xs:complexType>
</xs:element>
</xs:schema>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/430484.html
