This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Remove duplicate nodes in DOM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Remove duplicate nodes in DOM" Watch "Remove duplicate nodes in DOM" New topic

Remove duplicate nodes in DOM

Ankit Nagpal
Ranch Hand

Joined: Sep 09, 2008
Posts: 47


I am using the DOM API for a random XML operation and have a NodeList which contains the following 3 nodes (All element nodes):

In this list, I want to remove the duplicate node i.e. Node number 3. Does any one have any clues on how can I do the same?

Thanks in advance.

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13000
The org.w3c.dom.Node interface provides the removeChild method - have you tried that?

I agree. Here's the link:
subject: Remove duplicate nodes in DOM
It's not a secret anymore!