Meaningless Drivel is fun!*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "CDATA and jdom" Watch "CDATA and jdom" New topic

CDATA and jdom

francis varkey
Ranch Hand

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

Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

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
>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.]
subject: CDATA and jdom
Similar Threads
how to embed CDATA within another
Retrieve CDTA content from XML file
Trouble with Embedded HTML during XSLT Transformation using JDOM
parse xml
Insert empty field CDATA into an XML file using JDOM