Extracting CDATA Text without CDATA Tags???

Discussion in 'Java' started by John Davison, Jul 6, 2004.

  1. John Davison

    John Davison Guest

    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
     
    John Davison, Jul 6, 2004
    #1
    1. Advertising

  2. John Davison

    Hal Rosser Guest

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

    "John Davison" <> wrote in message
    news:...
    > 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
     
    Hal Rosser, Jul 7, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Porthos
    Replies:
    4
    Views:
    518
    David Carlisle
    Mar 14, 2005
  2. Replies:
    3
    Views:
    758
    Joe Kesselman
    Mar 6, 2006
  3. Dana B
    Replies:
    10
    Views:
    790
    Peter Flynn
    Sep 4, 2006
  4. Damo_Suzuki
    Replies:
    1
    Views:
    325
    Damo_Suzuki
    Dec 8, 2006
  5. yawnmoth

    ]]> in cdata tags

    yawnmoth, Jul 1, 2007, in forum: XML
    Replies:
    3
    Views:
    348
    Joe Kesselman
    Jul 1, 2007
Loading...

Share This Page