Hi santosh Please post these emails to the dom4j-user list.
FWIW you will be iterating over <SettlementDetail> instances. If you want to iterate through their children do this.,.. List list = document.selectNodes("//TerminalSettlement/SettlementDetails" ); for ( Iterator iter = list.iterator(); iter.hasNext(); ) { Element settlementDetail = (Element) iter.next(); List elements = settlementDetail.elements(); // now iterate through children for ( Iterator iter2 = elements.iterator(); iter2.hasNext() ); Element child = (Element) iter2.next(); System.out.println( "text for: " + child.getName() + " is: " + child.getText() ); } } James ------- http://radio.weblogs.com/0112098/ ----- Original Message ----- From: "Sahu, Santosh Kumar" <[EMAIL PROTECTED]> To: "James Strachan" <[EMAIL PROTECTED]> Sent: Thursday, August 22, 2002 1:59 PM Subject: Got into another problem Hi, have a look at the belo XML: <TerminalSettlement> <SettlementDetail><CaptureTranCode>5</CaptureTranCode><STAN>423089</STAN></S ettlementDetail> <SettlementDetail><CaptureTranCode>6</CaptureTranCode><STAN>012739</STAN></S ettlementDetail> <SettlementDetail><CaptureTranCode>7</CaptureTranCode><STAN>112557</STAN></S ettlementDetail> </TerminalSettlement> Here i have RootElement as <TerminalSettlement> and then i have three <settlementDetail>s. when i do a XpathExression like //TerminalSettlement/SettlementDetail i am getting a List of 3 three objects thats perfect. But the problem is i am not able to traverse through each object. code: List list = document.selectNodes("//TerminalSettlement/SettlementDetails" ); for ( Iterator iter = list.iterator(); iter.hasNext(); ) { Object object = iter.next(); int capCode= ;//Here this has to print all the three different values. System.out.println(capCode) int stan= ;//same as above. } I am trying in so many ways but it is not working in the way i want. if i complete this bit then i will be done with XML so can u please solve this problem. thanks, santosh __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE! https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user