cancel
Showing results for 
Search instead for 
Did you mean: 

XPATH Condition to check if an element does not exists

Former Member
0 Kudos

Hi Experts,

I want to know the XPATH condtion to check if an element does not exist.

I have searched the forum but could not find a relevant discussion.

Please help.

Regards,

Ravi kanth Talagana

Accepted Solutions (1)

Accepted Solutions (1)

prateek
Active Contributor
0 Kudos

Answers (2)

Answers (2)

udo_martens
Active Contributor
0 Kudos

Hi Ravi kanth Talagana,

count(//myElement) eq 0

Regards,

Udo

former_member181962
Active Contributor
0 Kudos

Hi Udo,

Is "eq" a valid XPATH Operator? or should i use "=" ?

I did not find it here:

http://www.w3schools.com/xpath/xpath_operators.asp

Regards,

Ravi Kanth Talagana

Regards,

Ravi Kanth Talagana

udo_martens
Active Contributor
0 Kudos

Hi Ravi Kanth Talagana,

both is possible.

Regards,

Udo

former_member200962
Active Contributor
0 Kudos

Left Operand should be your element on which you need to implement the condition

Middle Operand (Condition column) should be Not Equal

Right Operand should be constant EX

I used this condition in RD to route a file from source to target if some element is not present in the file....not present means not even a blank entry for the element....

Check it and let me know the result.

Regards,

Abhishek.

former_member181962
Active Contributor
0 Kudos

@Prateek: I have seen that, but that is to check if an expression exists, whereas I wanted the negation of that. i.e. NOt exists.

@Abhishek: I will try this work around and let you know.

Regards,

Ravi Kanth Talagana

former_member181962
Active Contributor
0 Kudos

But Abhishek, How is this condition different from

Element value not equal to the string "EX" ?

Say if we have used the condition

/Header/Item/Element not equals "10" , does this also check for the existance of the element?

Regards,

Ravi

Regards,

Ravi Kanth Talagana