xml - Using [not] in xpath to retrieve content that does not match given values (PLSQL) -


i'm trying use following code filter out xml return tags not contain given status code:

l_xml_return := (xmltype(l_xml_response).extract('//return[not(issuestatusid=84388)]|                                                                       //return[not(issuestatusid=73630)]|                                                                       //return[not(issuestatusid=67539)]|                                                                       //return[not(issuestatusid=42527)]|                                                                       //return[not(issuestatusid=22702)]|                                                                       //return[not(issuestatusid=20643)]|                                                                       //return[not(issuestatusid=4368)]|                                                                       //return[not(issuestatusid=4363)]|                                                                       //return[not(issuestatusid=4364)]                                                                      ').getclobval()); 

my xml comprised of following:

<results>   <return>     <issuestatusid>84388</issuestatusid>     <name>test 1</name>   </return>   <return>     <issuestatusid>4364</issuestatusid>     <name>test 2</name>   </return>   <return>     <issuestatusid>999999</issuestatusid>     <name>test 3</name>   </return> </results> 

with xml code , xpath statement, return tag issue status of 999999 should returned not case.

does know why is?

cheers,

jezzipin

from xpath 1.0 specs

the | operator computes union of operands, must node-sets.

whereas need intersection of these multiple //return[not(...)]

you can use and on multiple not() conditions predicate

//return[     not(issuestatusid=84388) ,     not(issuestatusid=73630) ,     not(issuestatusid=67539) ,     not(issuestatusid=42527) ,     not(issuestatusid=22702) ,     not(issuestatusid=20643) ,     not(issuestatusid=4368) ,     not(issuestatusid=4363) ,     not(issuestatusid=4364)] 

or equivalently:

//return[     not(         issuestatusid=84388 or         issuestatusid=73630 or         issuestatusid=67539 or         issuestatusid=42527 or         issuestatusid=22702 or         issuestatusid=20643 or         issuestatusid=4368 or         issuestatusid=4363 or         issuestatusid=4364         )     ] 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -