   | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Struts - A MVC web framework | | Tomcat - JSP/Servlet container | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | | JSP - A mailing list about Java Server Pages specification and reference | |
Struts & Hibernate
|
|
|
  | |  | getChildren(Filter) Bug? | getChildren(Filter) Bug? 2003-12-08 - By Joe McDaniel
Back No matter how I try to filter content, no filtering seems to actually occur. For instance, here is my snippet: Document doc = builder.build("sampleOrder.xml"); Element root = doc.getRootElement(); Namespace namespace = root.getNamespace(); Element lineItemsElement = root.getChild("LineItems", namespace); List lineItems = lineItemsElement.getChildren(); Iterator lineItemIterator = lineItems.iterator(); Element lineItem = null; while(lineItemIterator.hasNext() ) { lineItem = (Element)lineItemIterator.next(); List lineItemPrimers = 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? Joe
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE>Message</TITLE> <META http-equiv=Content-Type content="text/html; charset=us-ascii"> <META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD> <BODY> <DIV><SPAN class=129230217-08122003><FONT face=Arial size=2>No matter how I try to filter content, no filtering seems to actually occur. For instance, here is my snippet:</FONT></SPAN></DIV> <DIV><SPAN class=129230217-08122003><FONT face=Arial size=2></FONT></SPAN> </DIV> <DIV><SPAN class=129230217-08122003><FONT face=Arial size=2> Document doc = builder.build("sampleOrder.xml");<BR> Element root = doc.getRootElement();<BR> Namespace namespace = root.getNamespace();<BR> Element lineItemsElement = root.getChild("LineItems", namespace);<BR> List lineItems = lineItemsElement.getChildren();<BR> Iterator lineItemIterator = lineItems.iterator();<BR> Element lineItem = null;<BR> while(lineItemIterator.hasNext() ) <BR> {<BR> lineItem = (Element)lineItemIterator.next();<BR> List lineItemPrimers = lineItem.getChildren("Primer", namespace);</FONT></SPAN></DIV> <DIV><SPAN class=129230217-08122003><FONT face=Arial size=2> }<BR></DIV></FONT></SPAN> <DIV><SPAN class=129230217-08122003><FONT face=Arial size=2>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?</FONT></SPAN></DIV> <DIV><SPAN class=129230217-08122003><FONT face=Arial size=2></FONT></SPAN> </DIV> <DIV><SPAN class=129230217-08122003><FONT face=Arial size=2>Joe</FONT></SPAN></DIV></BODY></HTML>
|
|
|