Vicky
Vicky

Reputation: 53

The Filter condition using multiple XPATH fails

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:

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/emplo‌​yment_information/jo‌​b_information[1]/emp‌​loyee_class!='EX' and (person/employment_information/job_information[1]/event='26' and person/employment_information/job_information[1]/last_modifi‌​ed_on=person/employm‌​ent_information/job_‌​information[1]/custo‌​m_date1) ]

I am getting an error during runtime.

Can you help me in this.

Thanks, Vicky

Upvotes: 1

Views: 99

Answers (1)

Andersson
Andersson

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

Related Questions