[jdom-interest] Problem with getChild()

Jorge Acebo jacebo at essi.es
Tue Sep 26 03:25:04 PDT 2000


Hello.

I have an xml document that begins like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE record SYSTEM "IMS_METADATAv1p1.dtd">
<record xmlns="http://www.imsproject.org/metadata/">
 <metametadata>
      <catalogentry>
           <catalogue></catalogue>
      </catalogentry>
  </metametadata>
<general>
    .... etc...

and I have the next code to read the children of <record> element:

Element root = doc.getRootElement();
List a = root.getChildren();
Iterator i = a.iterator();
while ( i.hasNext() )
{
    Element e = (Element) i.next();
    System.out.println("Children: " + e.getName());
}

This works well, and list "metadata", "general", etc... But when I try
to acces to one child:

   Element e = root.getChild("metametadata");


getChild returns a null pointer.

Why?



-------------- next part --------------
A non-text attachment was scrubbed...
Name: jacebo.vcf
Type: text/x-vcard
Size: 203 bytes
Desc: Card for Jorge Acebo
Url : http://jdom.org/pipermail/jdom-interest/attachments/20000926/97707077/jacebo.vcf


More information about the jdom-interest mailing list