Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to Do this Extract from XMLtype (Xpath)?

OhayaNov 20 2016 — edited Nov 21 2016

Hi,

I am having trouble trying to do an extract from an Xmltype.

The Xmltype, decisionXml, contains:

<Response xmlns="urn:oasis:names:tc:xacml:2.0:context:schema:os"><Result ResourceId="AuthZ/protected/resource"><Decision>Permit</Decision><Status><StatusCode Value="urn:oasis:names:tc:xacml:1.0:status:ok"/></Status><ns2:Obligations xmlns:ns2="urn:oasis:names:tc:xacml:2.0:policy:schema:os"><ns2:Obligation FulfillOn="Permit" ObligationId="http://security.bea.com/ssmws/ssm-ws-1.0.wsdl#obligation_foo"><ns2:AttributeAssignment AttributeId="http://security.bea.com/ssmws/ssm-ws-1.0.wsdl#obligation_foo" DataType="http://www.w3.org/2001/XMLSchema#string">{salary=3000}</ns2:AttributeAssignment></ns2:Obligation></ns2:Obligations></Result></Response>

I need to get the value of the ns2:AttributeAssignment, i.e., the "{salary=3000}" as text.

I'm assuming that I have to use the form of the extract with namespace, but I have tried all kinds of variations, e.g.:

return_val := myDecisionXml2.extract('//ns2:AttributeAssignment/text()','xmlns="urn:oasis:names:tc:xacml:2.0:context:schema:os" xmlns:ns2="urn:oasis:names:tc:xacml:2.0:context:schema:os"').getStringVal();

but nothing is returning anything and the PL/SQL script seems to just end at that point (I have debug output after the above line, but that debug output never is output.

Thanks,

Jim

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2016
Added on Nov 20 2016
12 comments
656 views