2011-02-04 68 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