Wednesday, 28 August 2013

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

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

I'm trying to use the following code to filter out xml return tags that do
not contain a 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 is comprised of the 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 this xml code and xpath statement, only the return tag with an issue
status of 999999 should be returned however this is not the case.
Does anyone know why this is?
Cheers,
Jezzipin

No comments:

Post a Comment