Xml 如何使属性在xsd中唯一?

Xml 如何使属性在xsd中唯一?,xml,xml-parsing,xsd,xsd-validation,Xml,Xml Parsing,Xsd,Xsd Validation,XML: XSD: 我希望'screen'标签的'screenNumber'属性是唯一的。哪里出错了?可能是由于名称空间的原因,请尝试在选择器前面加前缀: ... <xsd:element name="configuration" type="configuration.configuration.type"> <xsd:unique name="uConfiguration"> <xsd:selector xpath="screen" />

XML:

XSD:


我希望'screen'标签的'screenNumber'属性是唯一的。哪里出错了?

可能是由于名称空间的原因,请尝试在选择器前面加前缀:

...
<xsd:element name="configuration" 
  type="configuration.configuration.type">
  <xsd:unique name="uConfiguration">
    <xsd:selector xpath="screen" /> 
    <xsd:field xpath="@screenNumber" /> 
  </xsd:unique>
</xsd:element>
...
<xsd:element name="configuration" 
  type="configuration.configuration.type">
  <xsd:unique name="uConfiguration">
    <xsd:selector xpath="screen" /> 
    <xsd:field xpath="@screenNumber" /> 
  </xsd:unique>
</xsd:element>
    <xsd:unique name="uConfiguration">
        <xsd:selector xpath="p:screen"/>
        <xsd:field xpath="@screenNumber"/>
    </xsd:unique>