My Oracle Support Banner

DBMS_XMLQUERY Gives XML Document Which Contains Invalid Character (Doc ID 397671.1)

Last updated on AUGUST 29, 2010

Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.2 and later   [Release: 10.2 and later ]
Information in this document applies to any platform.
Checked for Relevance on 30-Aug-2010

Goal

Running the following, where chr(25) is an invalid character per W3 standard, gives back an XML
document:

select DBMS_XMLQUERY.getxml('select ''Illegal Character: '' || CHR(25) as TEXTCOL from dual') from
dual;

<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<TEXTCOL>Illegal Character: </TEXTCOL>
</ROW>
</ROWSET>

If a valid character is used in the query it is replaced with a character entity as expected:

select DBMS_XMLQUERY.getxml('select ''Illegal Character: '' || CHR(38) as TEXTCOL from dual') from
dual;

<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<TEXTCOL>Illegal Character: &</TEXTCOL>
</ROW>
</ROWSET>

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
  Goal
  Solution
  References

Platforms: 1-914CU;

This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.