File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Head First Android this week in the Android 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: 169
Hi,
How to read CDATA from xml using jdom parser.

Thanks
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19693
    
  10

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

Joined: Jan 18, 2011
Posts: 583
    
    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.]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: CDATA and jdom
 
It's not a secret anymore!