Skip to Main Content

Database Software

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!

XML escape sequences for brackets and xmltype.extract

User_HWHT9Jun 29 2006 — edited Jun 30 2006

G'day gang, I'm hoping somebody would be kind enough to help me with the following query please.

I have a web service that is returning the following XML stream into an XMLType in the database:

<OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices">
  <OutOfStockAdviceResult>
  & lt;Response& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;
  & lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;
  & lt;/Response& gt;
  </OutOfStockAdviceResult>
</OutOfStockAdviceeResponse>

You'll note the & lt; and & gt; characters (note to display these strings in OTN I've had to add a space between the & and the lt; or gt;. The spaces don't actually occur in the real XML data coming back).

What's odd about this XML stream coming back is it is mixing the use of the XML angle brackets with the escape character equivalents (eg. & lt; and & gt;) half way through the XML stream. Is this valid for an XML stream to do this? Any idea what would cause this? Is it possible the source is creating 2 separate XML streams using different character sets and then concatenating them to get this result?

The reason I'm asking is I'm attempting via PL/SQL to extract the ResponseCode and ResponseMessage tags with the following code:

  v_response_code := XMLType.extract(v_response, 
      '/OutOfStockAdviceResponse/OutOfStockAdviceResult/Response/ResponseCode/text()', 
      'xmlns="http://abc.org/abcWebServices"').getnumberval;
  v_response_msg  := XMLType.extract(v_response, 
      '/OutOfStockAdviceResponse/OutOfStockAdviceResult/Response/ResponseMessage/text()', 
      'xmlns="http://abc.org/abcWebServices"').getstringval;

Both calls are failing with:

ORA-30625: method dispatch on NULL SELF argument is disallowed

Can anybody point me in the right direction for solving this issue? Is there a way to get the xmltype.extract function to recognize the different character encoding schemes (if they do indeed actually exist)?

Any help appreciated.

CM.

PS. Apologize for the weak subject line.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 28 2006
Added on Jun 29 2006
2 comments
1,457 views