用于比较camel Java DSL中的属性值的表达式

时间:2016-09-30 11:31:42

标签: java xpath apache-camel

我想用XPath编写一个表达式,用于将我的xml邮件头中的属性值与某个值进行比较,以将其指向适当的文件夹。

from("file:testxml/")
                .choice()
                .when()
//              .xpath("urn:hl7-org:v3:Books/urn:hl7-org:v3:code/@code = '12.3.34.65'")
                .xpath("urn:hl7-org:v3:ClinicalDocument/urn:hl7-org:v3:code[@code='12.3.34.65']")
                .to("file:xPath/")
                .to("direct:xpath");

            }

我想将某个节点attirbute(代码元素的属性代码)与值进行比较,并将其指向一个保持为true的文件夹。

我写了类似

的内容
<label mdl class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-1">
    <input mdl type="checkbox" id="checkbox-1" class="mdl-checkbox__input" [(ngModel)]="loginRegisterData.termsConditions" #termsConditions (keyup.enter)="clickRegisterButton()">
    <span class="mdl-checkbox__label">I agree to the <a (click)="setVisiblePanel(5)" class="mouseHand">Terms and Conditions</a></span>
</label>

我想检查属性的值是否为&#39; 12.3.34.65&#39;。能否请你纠正我,让我知道如何以正确的方式编写xpath表达式。

非常感谢!

1 个答案:

答案 0 :(得分:0)

您的示例x​​ml无效。代码元素的属性代码也不是'12 .3.34.65'。请尝试以下方法将输出重定向到destinationFolder。

from("file:testxml")
 .choice()
  .when()
   .xpath("/Books/code[@code='x.x.x.x']")
   .to("file:destinationFolder");
相关问题