相关疑难解决方法(0)

XSD 1.1条件类型赋值<alternative test ="">检查元素是否没有设置属性?

我想问一下,如果某个元素没有使用XPath查询的属性,有人知道如何进行XSD 1.1条件类型赋值检查,例如:

<!--inline alternative type definitions --> 
<element name="TimeTravel" type="TravelType"> 
      <alternative test="@direction='Future'"> 
          <complexType> 
              <complexContent> 
              <restriction base="TravelType" 
                         .... 
<!--        some past travel related elements go here --> 
            </complexType> 
       </alternative> 
      <alternative test="@direction='Past'"> 
          <complexType> 
              <complexContent> 
              <restriction base="TravelType" 
                         .... 
   <!--        some future travel related elements go here --> 
            </complexType> 
       </alternative> 
  </element> 
                          OR 
<!--Named alternative type definitions --> 
<element name="TimeTravel" type="TravelType"> 
   <alternative test="@direction='Future' type="FutureTravelType"/> 
   <alternative test="@direction='Past' type="PastTravelType"/> 
</element>
Run Code Online (Sandbox Code Playgroud)

在此示例中,'alternative test =""'检查TimeTravel元素的属性"direction"是否具有值"Future"或"Past".我应该如何编写XPath查询以检查例如当前元素是否没有"direction"属性?

xml xpath xsd-validation xsd-1.1

3
推荐指数
1
解决办法
1754
查看次数

标签 统计

xml ×1

xpath ×1

xsd-1.1 ×1

xsd-validation ×1