2011-02-04 119 views

回答

1

與W3C XML模式語言的1.1版本(版本仍在開發中,但Xerces和薩克森已經實現的一些功能),可以使用e.g

<xs:element name="link"> 
    <xs:complexType> 
    <xs:attribute name="from" type="xs:string"/> 
    <xs:attribute name="to" type="xs:string"/> 
    <xs:assert test="@from ne @to"/> 
    </xs:complexType> 
</xs:element> 

http://www.w3.org/TR/xmlschema11-1/#cAssertions