您有以下xml,我需要选择属性类型=选择的Id
我已经使用了cost center:payload.ns0#Job_Application_Job_Requisition_Position.ns0#CostCenter.*ns0#ID[?($.@type == "select")],
,但它没有工作,因为它给出了一个id val;在成本标签内,请帮助
wd:Job_Application_Job_Requisition_Position>
<wd:CostCenter wd:Descriptor="0801009345 AUDIT-N AMER SOFT DRINK/FOODS">
<wd:ID wd:type="WID">e441a75b6dfb1097d9556f00a3e2a2af</wd:ID>
<wd:ID wd:type="select">0801009345</wd:ID>
<wd:ID wd:type="Cost_Center_Reference_ID">0801009345</wd:ID>
</wd:CostCenter>
</wd:Job_Application_Job_Requisition_Position>
答案 0 :(得分:4)
你的意思是你得到ID值=&#34; Cost_Center_Reference_ID&#34;?
boolean foobar = false;
foobar = condition;
我在上面检查过,它正确地给了我ID的值,其中type是Select。
示例输入 -
%dw 1.0
%output application/json
---
{
a: payload.Job_Application_Job_Requisition_Position.CostCenter.*ID[?($.@type == "select")]
}
输出 -
<?xml version='1.0' encoding='UTF-8'?>
<Job_Application_Job_Requisition_Position >
<CostCenter Descriptor="0801009345 AUDIT-N AMER SOFT DRINK/FOODS">
<ID type="WID">e441a75b6dfb1097d9556f00a3e2a2af</ID>
<ID type="select">0801009347</ID>
<ID type="Cost_Center_Reference_ID">0801009346</ID>
</CostCenter>
</Job_Application_Job_Requisition_Position>
注意:在您的示例中,select和Cost_Center_Reference_ID的输入ID值相同,不确定如何区分它来自成本?这是问题吗?