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!

How to wrap data in CDATA in XML

390969Nov 26 2003 — edited Jul 14 2004
I want to wrap my XML data in CDATA but don't know how to do it. Your help is highly appreciated.
Hre is the piece of code I am using:

sql_statement = "SELECT NEWS_ID, HEADLINE FROM CM_NEWS WHERE NEWS_ID = 101";
conn = dataSource.getConnection();
qry = new OracleXMLQuery(conn, sql_statement);
qry.setRowTag(null);
qry.setDateFormat("MMM dd yyyy");
qry.setEncoding("ISO-8859-1");
qry.setRowsetTag("document");
// Get the XML string
str = qry.getXMLString();
qry.close();


It returns following output:
<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
<NEWS_ID>101</NEWS_ID>
<HEADLINE>PG.com Success Story</HEADLINE>
</document>

But I want the data to be wraped around <![CDATA[ ]]> as its shown below:

<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
<NEWS_ID><![CDATA[101]]></NEWS_ID>
<HEADLINE><![CDATA[PG.com Success Story]]></HEADLINE>
</document>

Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 11 2004
Added on Nov 26 2003
5 comments
716 views