Hi,
I wonder if there are some kind of "clon" of XMLCDATA SQL function for Ora9. This function exists in Ora10 but sadly not in Ora9.
I need to include the <![CDATA[ ]]> in a XMLElement sentence, i.e
select xmlelement("test",'123')
from dual
But when I try to hardcore the CDATA the A.I of XMLElement converts it to entities and then get a result like this
SQL> select xmlelement("test",'<![CDATA[123]]>') from dual
2 /
XMLELEMENT("TEST",'<![CDATA[123]]>')
-----------------------------------------------------------
<test><![CDATA[123]]></test>
SQL>
Are there some way to bypass the converts triggered by the XMLElement of Ora9?
If there are not a solution to this: someone knows how to convert characters others than <,> using a existent SQL function?, I mean a DBMS_XMLGen.Convert in steroids .
i.e: I have a spanish word like "ESPAŅA" and need to write this in a XML file like (the space before and after the ampersand must not exists in the XML file to write, I put them just to show in the example).
Any help will be welcome. Thanks a lot.
Cheers!
*** UPDATE, AUTORESPONSE ***
Must create this workaround function and then use it inside the xmlelement sentence:
create or replace
FUNCTION XMLCDATA (elementname VARCHAR2, cdatavalue VARCHAR2)
RETURN XMLTYPE
AS
BEGIN
RETURN XMLTYPE ( '<'
|| elementname
|| '><![CDATA['
|| cdatavalue
|| ']]></'
|| elementname
|| '>'
);
END;
found this at Oracle Community Discussion Forums. Example to use it in Ora9:
SELECT XMLELEMENT ("usuario", XMLCDATA ('nombre', 'Juan Perez')).EXTRACT('/*') result
FROM DUAL
[Updated on: Tue, 06 November 2007 08:33]
Report message to a moderator