Reputation: 53
I am trying to implement multiple filter using the xpath
such that the output of the filter is all the CompoundEmployee
nodes which have the following:
All the job_information
first occurrence should not have employee_class
as EX
All the job_information
first occurrence can have all the events
than 26
The event
26
can appear only in the case when last_modified_on
= custom_date1
The source xml
is
<?xml version="1.0" encoding="utf-8"?>
<queryCompoundEmployeeResponse>
<CompoundEmployee>
<person>
<employment_information>
<job_information>
<employee_class>WC</employee_class>
<event>26</event>
<event_reason>FUNDBREA</event_reason>
<last_modified_on>20170215</last_modified_on>
<custom_date1>20170215</custom_date1>
</job_information>
</employment_information>
</person>
</CompoundEmployee>
</queryCompoundEmployeeResponse>
The xpath filter I am using is
/queryCompoundEmployeeResponse/CompoundEmployee[person/employment_information/job_information[1]/employee_class!='EX' and (person/employment_information/job_information[1]/event='26' and person/employment_information/job_information[1]/last_modified_on=person/employment_information/job_information[1]/custom_date1) ]
I am getting an error during runtime.
Can you help me in this.
Thanks, Vicky
Upvotes: 1
Views: 99
Reputation: 52685
Try below and let me know the result:
//CompoundEmployee[person[employment_information[job_information[not(employee_class="EX")][not(event="26") or last_modified_on=custom_date1]]]]
Above expression should return
CompoundEmployee
node
that includes person
that includes employment_information
that includes job_information
with employee_class!=EX
and event!=26
but if last_modified_on==custom_date1
, then event==26
is also acceptable
Upvotes: 1