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 extract the value of one XML tag using Regular Expressions

user12240205Nov 11 2015 — edited Nov 11 2015

We get a XML response from a WEB-SERVICE.

I convert it to VARCHAR2.

Now, I want to get the actual reponse which is in the Response tag.

I tried this:

DECLARE

  v_1 VARCHAR2(30000) := '<soap:Body><ns:ProcessArgusFeedsResponse xmlns:ns="urn:PegaRULES:SOAP:ArgusToPegaFeeds:Services">' ||

                          '<Response>Good</Response></ns:ProcessArgusFeedsResponse></soap:Body>';

  v_response VARCHAR2(100);

BEGIN

   DBMS_OUTPUT.PUT_LINE(V_1);

   v_response := REGEXP_SUBSTR(v_1, '/<Response>(.+?)<\/Response>/');

   dbms_output.put_line(v_response);

END;

This does not work.

Any help would be greatly appreicated.

This post has been answered by Frank Kulash on Nov 11 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 9 2015
Added on Nov 11 2015
12 comments
5,868 views