[jdom-interest] CDATA question...

Jon Baer jonbaer at digitalanywhere.com
Wed Jul 4 01:49:05 PDT 2001


I have this as a method, is this correct?  The example takes something
like:

<javascript>
<![CDATA[
var i = 123; new String(i);
]]</javascript>

But cdata.getText() is returning empty, am I using it right?

public String getResult(Match match, Element javascript, String id) {
  List list = javascript.getContent();
  Iterator i = list.iterator();
  while (i.hasNext()) {
   Object o = i.next();
   if (o instanceof CDATA) {
    CDATA cdata = (CDATA)o;
    System.out.println("Evaluating: " + cdata.toString());
    return evaluate(cdata.getText(), id);
   }
  }
  return "";
 }




More information about the jdom-interest mailing list