[jdom-interest] getChildren(Filter) Bug?

Bradley S. Huffman hip at cs.okstate.edu
Mon Dec 8 17:40:58 PST 2003


What version of JDOM and what does sampleOrder.xml look like?

Brad

"Joe McDaniel" writes:

> This is a multi-part message in MIME format.
> 
> ------_=_NextPart_001_01C3BDAE.151BD0F8
> Content-Type: text/plain;
> 	charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
> 
> No matter how I try to filter content, no filtering seems to actually
> occur.  For instance, here is my snippet:
> =20
>         Document doc =3D builder.build("sampleOrder.xml");
>         Element root =3D doc.getRootElement();
>         Namespace namespace =3D root.getNamespace();
>         Element lineItemsElement =3D root.getChild("LineItems",
> namespace);
>         List lineItems =3D lineItemsElement.getChildren();
>         Iterator lineItemIterator =3D lineItems.iterator();
>         Element lineItem =3D null;
>         while(lineItemIterator.hasNext() )=20
>         {
>             lineItem =3D (Element)lineItemIterator.next();
>             List lineItemPrimers =3D lineItem.getChildren("Primer",
> namespace);
>         }
> 
> lineItemPrimers contains not just Primer elements but all elements in a
> LineItem.  When I look at the code for getChildren(...), I see no place
> where filtering actually takes place.  Am I missing something or is this
> a bug?
> =20
> Joe
> 
> ------_=_NextPart_001_01C3BDAE.151BD0F8
> Content-Type: text/html;
> 	charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD><TITLE>Message</TITLE>
> <META http-equiv=3DContent-Type content=3D"text/html; =
> charset=3Dus-ascii">
> <META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR></HEAD>
> <BODY>
> <DIV><SPAN class=3D129230217-08122003><FONT face=3DArial size=3D2>No =
> matter how I try=20
> to filter content, no filtering seems to actually occur.&nbsp; For =
> instance,=20
> here is my snippet:</FONT></SPAN></DIV>
> <DIV><SPAN class=3D129230217-08122003><FONT face=3DArial=20
> size=3D2></FONT></SPAN>&nbsp;</DIV>
> <DIV><SPAN class=3D129230217-08122003><FONT face=3DArial=20
> size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Document doc =3D=20
> builder.build("sampleOrder.xml");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
> &nbsp;=20
> Element root =3D=20
> doc.getRootElement();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> Namespace=20
> namespace =3D =
> root.getNamespace();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
> Element lineItemsElement =3D root.getChild("LineItems",=20
> namespace);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List lineItems =
> =3D=20
> lineItemsElement.getChildren();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
> bsp;=20
> Iterator lineItemIterator =3D=20
> lineItems.iterator();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> Element=20
> lineItem =3D null;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
> while(lineItemIterator.hasNext() )=20
> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
> {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> lineItem=20
> =3D (Element)lineItemIterator.next();<BR>&nbsp;&nbsp;&nbsp;=20
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List lineItemPrimers =3D=20
> lineItem.getChildren("Primer", namespace);</FONT></SPAN></DIV>
> <DIV><SPAN class=3D129230217-08122003><FONT face=3DArial=20
> size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> }<BR></DIV></FONT></SPAN>
> <DIV><SPAN class=3D129230217-08122003><FONT face=3DArial =
> size=3D2>lineItemPrimers=20
> contains not just Primer elements but all elements in a LineItem.&nbsp; =
> When I=20
> look at the code for getChildren(...), I see no place where filtering =
> actually=20
> takes place.&nbsp; Am I missing something or is this a =
> bug?</FONT></SPAN></DIV>
> <DIV><SPAN class=3D129230217-08122003><FONT face=3DArial=20
> size=3D2></FONT></SPAN>&nbsp;</DIV>
> <DIV><SPAN class=3D129230217-08122003><FONT face=3DArial=20
> size=3D2>Joe</FONT></SPAN></DIV></BODY></HTML>
> =00
> ------_=_NextPart_001_01C3BDAE.151BD0F8--
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost
> .com



More information about the jdom-interest mailing list