This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes CDATA and jdom Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "CDATA and jdom" Watch "CDATA and jdom" New topic
Author

CDATA and jdom

francis varkey
Ranch Hand

Joined: Sep 13, 2005
Posts: 166
Hi,
How to read CDATA from xml using jdom parser.

Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

It's just a text node, isn't it? What have you tried so far?
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 499
    
    3
>How to read CDATA from xml using jdom parser.
One of the typical occurrence of getting to a content List through .getContent().iterator(), and then use .next() to arrive at an object (o) of type typically uncertain. You then have to test the type of the object (o) through a cascade of if... else if...

The CDATA object uses getValue() above, or for that matter it can use getText(), getTextTrim() etc... all inherited from Text class as CDATA subclass Text. The casting step of o to CDATA is important.

[note: edited a typo.]
 
wood burning stoves
 
subject: CDATA and jdom
 
Similar Threads
Retrieve CDTA content from XML file
Trouble with Embedded HTML during XSLT Transformation using JDOM
how to embed CDATA within another
parse xml
Insert empty field CDATA into an XML file using JDOM