You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by tom john <cy...@yahoo.com> on 2002/04/16 16:51:49 UTC

proplem converting CDATA

Hi,
i get xmldata encapsulated in CDATA section as
follows:

...
<data>
  <![CDATA[
    <name>abc</name>
    <tel>1111</tel>
  ]]>
</data>
...

I need to get the data inside CDATA section and create
new node as:

<guest>
  <name>abc</name>
  <tel>1111</tel>
</guest>

what is the easiest way to do it? the content inside
the cdata section is not always the same but always
'well formed'.

tom



__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: proplem converting CDATA

Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "t" == tom john <cy...@yahoo.com> writes:

    t> Hi, i get xmldata encapsulated in CDATA section as follows:

    t> ...  <data> <![CDATA[ <name>abc</name> <tel>1111</tel> ]]>
    t> </data> ...

If you have the option of creating an intermediate file (or
StringWriter?), you could write the CDATA section with <xsl:value-of
disable-output-encoding="yes" select="."/>

-- 
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless.  They can only give you answers."(Pablo Picasso)


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: proplem converting CDATA

Posted by Elena Litani <el...@ca.ibm.com>.
tom john wrote:
> <data>
>   <![CDATA[
>     <name>abc</name>
>     <tel>1111</tel>
>   ]]>
> </data>
> I need to get the data inside CDATA section and create
> new node as:

Get CDATA value (string), wrap it using a dummy root element (i.e.
<myroot><name>abc</name><tel>1111</tel></myroot> ), and parse this
string using DOMParser. 
Use adoptNode() to move children of "myroot" to the original document.

-- 
Elena Litani / IBM Toronto

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org