- From: Tim Junker <tim.j@stk.jlteamworks.com>
- Date: Wed, 23 Sep 2009 13:05:04 -0700
- To: <www-dom@w3.org>
- Message-ID: <86C487D6AB051E4094574619DF82B4382389D1@ap01.stk.jlteamworks.com>
Hi Guys, I am using theElement.getParentNode().removeChild(theElement) to remove child nodes. My xmls look like the following. <root> <acct acct="12345"> <children>... </acct> <acct acct="12345"> <children>... </acct> <acct acct="12345"> <children>... </acct> </root> I load an array an unmatched keys and I want to remove all of them. Works "Most of the Time". For reasons I can not explain some times it appears to simply ignore the remove child request. Sadly that will not work. I am using sun java version 1.6.0_13... Code follows: for(int i=0;i<nlTran.getLength();i++){ it = unMatched.iterator(); theElement = (Element) nlTran.item(i); nnmD = nlTran.item(i).getAttributes(); matchAcct = nnmD.getNamedItem("tAcct").getTextContent().trim(); while(it.hasNext()){ if((matchAcct.equals(it.next()))&&(theElement.getNodeType()==Node.ELEMEN T_NODE)){ try{ Node removed = theElement.getParentNode().removeChild(theElement); }catch(Exception de){ System.out.println(de.getLocalizedMessage()); } break; } } } unmatched is an arraylist of account numbers to remove tAcct is the tran account number. I am processing a list of files and it works on all but 6 of 26 files. I am not seeing any exceptions raised. WTF-YO Tim Junker SR Programmer Analist J&L TeamWorks
Received on Thursday, 24 September 2009 07:17:08 UTC