Extracting CDATA Text without CDATA Tags???

J

John Davison

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
 
H

Hal Rosser

yep,
read a char at a time.
begin adding to the stringbuffer after CDATA[
stop adding to stringbuffer when you encounter the ]

John Davison said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top