我目前正在建立一個XSD來驗證我正在處理的一些XML,我猜這可能是不可能的,但我想知道是否有某種方式來強制執行屬性是「;」以分隔列表爲例分號分隔xs:屬性xsd
<nbsp style="cell-width:1.29;background-color:#99CC00;"/>
類似於style屬性在html中的工作方式。
在此先感謝
我目前正在建立一個XSD來驗證我正在處理的一些XML,我猜這可能是不可能的,但我想知道是否有某種方式來強制執行屬性是「;」以分隔列表爲例分號分隔xs:屬性xsd
<nbsp style="cell-width:1.29;background-color:#99CC00;"/>
類似於style屬性在html中的工作方式。
在此先感謝
您可以指定一個類必須特定pattern匹配。
實施例:
<simpleType name='better-us-zipcode'>
<restriction base='string'>
<pattern value='[0-9]{5}(-[0-9]{4})?'/>
</restriction>
</simpleType>
使用正則表達式來驗證內容。
<xs:attribute name="code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z][A-Z]"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
也看到
http://www.w3schools.com/Schema/el_attribute.asp 和 http://www.w3schools.com/schema/schema_simple_attributes.asp 和 http://www.w3schools.com/schema/schema_facets.asp
測試您的正則表達式在這裏:http://regexlib.com/RETester.aspx
謝謝,我知道這一點,但這個意圖是獲得一些如果可能的話,可以使用上下文幫 – 2010-07-05 14:06:38