[jdom-interest] Pb with getChildren and xmlns tags in b4

Vincent Aumont vincent.aumont at vslab.com
Fri Jun 9 23:21:49 PDT 2000


I've just downloaded b4 and found out that getChildren returns
an empty list if the root element contains  a 'xmlns' tag.
The following code snippet demonstrates the problem.

-Vincent.

import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;

public class test {
 public static void main (String[] args) {
   String xml = "<root
xmlns=\"whatever\"><child>content</child></root>";
  try {
    org.jdom.Document doc = new org.jdom.input.SAXBuilder().build(new
java.io.StringReader(xml) );

System.out.println(doc.getRootElement().getChildren("child").size()); //
prints 0
    }
    catch (Exception e) {e.printStackTrace();}
  }
}




More information about the jdom-interest mailing list