Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Extracting CDATA Text without CDATA Tags???

Reply
Thread Tools

Extracting CDATA Text without CDATA Tags???

 
 
John Davison
Guest
Posts: n/a
 
      07-06-2004
When I call node.getNodeValue() on a CDATA node, I get the following
string:

<![CDATA[
<?xml version="1.0"?>
<RESPONSE>
<ERRORMSG>INVALID USER</ERRORMSG>
</RESPONSE>
]]>

Is there a convenient way to get just the CDATA text? In other words,
I want the following output without the CDATA tags:

<?xml version="1.0"?>
<RESPONSE>
<ERRORMSG>INVALID USER</ERRORMSG>
</RESPONSE>

Thanks in advance,

John
 
Reply With Quote
 
 
 
 
Hal Rosser
Guest
Posts: n/a
 
      07-06-2004
yep,
read a char at a time.
begin adding to the stringbuffer after CDATA[
stop adding to stringbuffer when you encounter the ]

"John Davison" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> When I call node.getNodeValue() on a CDATA node, I get the following
> string:
>
> <![CDATA[
> <?xml version="1.0"?>
> <RESPONSE>
> <ERRORMSG>INVALID USER</ERRORMSG>
> </RESPONSE>
> ]]>
>
> Is there a convenient way to get just the CDATA text? In other words,
> I want the following output without the CDATA tags:
>
> <?xml version="1.0"?>
> <RESPONSE>
> <ERRORMSG>INVALID USER</ERRORMSG>
> </RESPONSE>
>
> Thanks in advance,
>
> John



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.714 / Virus Database: 470 - Release Date: 7/2/2004


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retrieve XML CDATA text contents by org.xml.sax.ext.DefaultHandler2? RC Java 6 05-04-2009 11:33 PM
Extracting values from CDATA Dana B XML 10 09-04-2006 10:20 PM
Can I un-CDATA my CDATA section and elaborate a transformation for the contained data? troppfigo@excite.it XML 3 03-06-2006 03:01 AM
Does XPath text() return CDATA SECTION? Tak Sze XML 2 04-30-2004 12:38 AM
How can I have ']]>' as a text inside CDATA in xml Neeraj Agrawal XML 3 10-29-2003 02:35 PM



Advertisments