This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma 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 Java Interview Guide this week in the Jobs Discussion 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: 169
How to read CDATA from xml using jdom parser.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

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

Joined: Jan 18, 2011
Posts: 633
>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.]
I agree. Here's the link:
subject: CDATA and jdom
It's not a secret anymore!