在XML中使用逻辑

时间:2012-08-22 20:32:12

标签: xml

我基本上想在XML中使用以下逻辑

obj必须是((MASTER || PART)&&(Drawing))

这似乎不起作用

<adapt type="com.teamcenter.rac.kernel.TCComponent">
       <or>
          <test property="type"
               value="MASTER">
          </test>
          <test property="type"
               value="UGPART">
          </test>
       </or>
       <and>
          <test property="DRAWING"
                value= "">
          </test>
       </and>       
  </adapt>

它必须是以下之一(MASTER或PART)并且是DRAWING 我主要担心如何将该逻辑添加到上面的XML

1 个答案:

答案 0 :(得分:2)

假设您的XML元素和属性具有明显的含义,我希望捕获((MASTER || PART) && (Drawing))含义的正确方法是

<adapt type="com.teamcenter.rac.kernel.TCComponent">
  <and>
    <or>
      <test property="type"
            value="MASTER">
      </test>
      <test property="type"
            value="UGPART">
      </test>
    </or>
    <test property="DRAWING"
          value= "">
    </test>
  </and>       
</adapt>

但这是纯粹的推测,因为我不知道哪些软件无法理解你想说的内容。