Home » Developer & Programmer » JDeveloper, Java & XML » convert clob into xmltype without a docType
convert clob into xmltype without a docType [message #459142] Thu, 03 June 2010 09:47 Go to next message
b_52globemaster
Messages: 51
Registered: July 2005
Member
Hi,


saw the topic here http://www.orafaq.com/forum/t/45411/0/

about tranforming a clob to a xmltype , but was wondering if it's possible to get a result without a docType


instead of
<?xml version="1.0"?>
 <EMP>
   <EMPNO>221</EMPNO>
   <ENAME>John</ENAME>
 </EMP>


only

<EMP>
   <EMPNO>221</EMPNO>
   <ENAME>John</ENAME>
 </EMP>



and thanks
Re: convert clob into xmltype without a docType [message #459151 is a reply to message #459142] Thu, 03 June 2010 10:40 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Don't put it in the original string.
In the topic you refer, Frank did:
SQL> INSERT INTO clobtab VALUES (
  2  '<?xml version="1.0"?>
  3   <EMP>
  4     <EMPNO>221</EMPNO>
  5     <ENAME>John</ENAME>
  6   </EMP>');

So if you don't put the first tag in the string you have not in the data.
Or do you mean something else, in this case post a complete test case then we can see what is your input and what do you want to get.

Regards
Michel
Re: convert clob into xmltype without a docType [message #459156 is a reply to message #459142] Thu, 03 June 2010 11:11 Go to previous messageGo to next message
b_52globemaster
Messages: 51
Registered: July 2005
Member
Hi Michel,


Quote:
So if you don't put the first tag in the string you have not in the data.

Embarassed ........... ( i need glaces...)


yeah in fact my problem is

i'm using a xmlserialze like:

SELECT (
  select XMLSerialize
  (
   CONTENT
    xmlelement("data",(select 1 from dual))
  )
  from dual
      )from dual


and i need to transform the clob to an xmltype?
is this possible ?
Re: convert clob into xmltype without a docType [message #459158 is a reply to message #459156] Thu, 03 June 2010 11:21 Go to previous messageGo to next message
Solomon Yakobson
Messages: 3269
Registered: January 2010
Location: Connecticut, USA
Senior Member
SELECT  XMLTYPE(
                (
                 select  XMLSerialize(
                                      CONTENT
                                      xmlelement("data",(select 1 from dual))
                                     )
                   from  dual
               )
              )
  from  dual
/


SY.
Re: convert clob into xmltype without a docType [message #459160 is a reply to message #459158] Thu, 03 June 2010 11:35 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So why not directly:
SQL> select XMLTYPE (
  2   XMLSerialize   (
  3     CONTENT
  4      xmlelement("data",(select 1 from dual))
  5    ))
  6  from dual
  7  /
XMLTYPE(XMLSERIALIZE(CONTENTXMLELEMENT("DATA",(SELECT1FROMDUAL))))
-------------------------------------------------------------------
<data>1</data>

Regards
Michel
Re: convert clob into xmltype without a docType [message #459162 is a reply to message #459160] Thu, 03 June 2010 11:38 Go to previous message
b_52globemaster
Messages: 51
Registered: July 2005
Member
thanks.
Previous Topic: small problem with XMLSerialize
Next Topic: xmlelement inside an xmlement !
Goto Forum:
  


Current Time: Thu Mar 28 04:18:57 CDT 2024