的XML允許可變數目後跟數字Q的屬性,這樣如何將XSD屬性名稱定義爲正則表達式?
<recognitionPattern Q0="12.5" Q1="12.5" Q2="12.5" Q3="12.5" Q4="12.5" Q5="12.5" Q6="12.5" Q7="12.5"/>
我目前的解決方案看起來是這樣的:
<xs:complexType name="PerQuarterDoubleHack"> <!-- YUCK! /> -->
<xs:attribute name="Q0" type="xs:double" />
<xs:attribute name="Q1" type="xs:double" />
<xs:attribute name="Q2" type="xs:double" />
<xs:attribute name="Q3" type="xs:double" />
<xs:attribute name="Q4" type="xs:double" />
<xs:attribute name="Q5" type="xs:double" />
<xs:attribute name="Q6" type="xs:double" />
<xs:attribute name="Q7" type="xs:double" />
</xs:complexType>
我見過很多的正則表達式的應用的值,但從來沒有一個屬性名稱。 我有更改XML嗎?
http://stackoverflow.com/questions/832542/xsd-attribute-and-element-validation – sreehari 2012-07-11 16:45:31