SV: [jdom-interest] Problem getting children

Per Norrman pernorrman at telia.com
Tue Aug 26 05:50:47 PDT 2003


Hi,

this is not a schema problem, it's a namespace problem.

Your'e asking for the child elements which belongs to no
namespace, <a> belongs to the same namespace as <rootnode>.

Try
    root.getChildren("a", root.getNamespace());
instead.

/pmn


> -----Ursprungligt meddelande-----
> Från: jdom-interest-admin at jdom.org 
> [mailto:jdom-interest-admin at jdom.org] För Kenneth Ellefsen
> Skickat: den 26 augusti 2003 11:28
> Till: jdom-interest at jdom.org
> Ämne: [jdom-interest] Problem getting children
> 
> 
> Hi!
> 
> I've been using jdom for quite a while, but haven't had to 
> look into schemas yet.
> 
> I now have the following problem.
> 
> I recive a xml file from an external source that contains a 
> schema like this example:
> 
> <rootnode xmlns="x-schema:SomeSchema.xdr">
> <a/>
> <rootnode>
> 
> I parse the file using SAXParser, and get the root element.
> 
> If I try to do:
> 
> root.getChildren("a");
> 
> I get an empty list back.
> 
> If I remove the root attribute 
> xmlns="x-schema:SomeSchema.xdr" the same code gets the a elements.
> 
> I'm using Jdom B8, and can't upgrade at this point in time.
> 
> Any suggestions what to do?
> 
> Thanks,
> Kenneth
> 
> _______________________________________________
> To control your jdom-interest membership: 
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com




More information about the jdom-interest mailing list