Its not a one liner but this would do the trick. You could wrap this up as a
helper method in your code if you like
boolean hasCDATA = false;
for ( int i = 0, size = element.nodeCount(); i < size; i++ ) {
Node node = element.node(i);
if ( node instanceof CDATA ) {
hasCDATA = true;
break;
}
}
James
----- Original Message -----
From: "Brian Young" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 14, 2002 7:28 PM
Subject: [dom4j-user] problem detecting CDATA
> I'm writing some code where I need to know whether an element contains a
> CDATA section or not, but am having trouble determining this with the
> top level dom4j interfaces. Element.getText() obviously just returns a
> String representing all of the text whether it was in a CDATA section or
> not.
>
> It is rather likely I am just missing something- so please point me in
> the right direction.....
>
> Thanks
>
>
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user