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 extarct the tag value from an XML

3424134Apr 19 2017 — edited Apr 21 2017

I have this XML

<?xml version="1.0" encoding="UTF-8"?>

<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">

<fields><field name="ATest1"><value>MGM Family</value></field>

<field name="ATestRNo"><value>46464647738</value></field>

<field name="IName"><value></value></field>

</fields>

</xfdf>

I write this:

Declare

    tagValue VARCHAR(100);

    xml      xmltype;

Begin

xml := xmltype.createxml(out_clob);

  SELECT EXTRACTVALUE ( xml, '//ATestRNo', 'xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"') INTO tagValue

  FROM dual;

  dbms_output.put_line ('EXTRACTVALUE = ' || tagValue );

end;

I run on SQL - DEVELOPER. I am getting this error:

ORA-31013: Invalid XPATH expression

ORA-06512: at "SQLOWNER", line 6

ORA-06512: at line 2

I expect output 46464647738.

Any pointers?

This post has been answered by Anton Scheffer on Apr 19 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 19 2017
Added on Apr 19 2017
16 comments
7,394 views