Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

[closed] [duplicate] Issue in removing a node

I am tried to remove one node with this code  below.

But it is removing all nodes with this tag

NodeList defectList = (NodeList) doc.getElementsByTagName("oslc_cm:tracksWorkItem");
   System.out.println("defectList.getLength() "+defectList.getLength());
   for(int i=defectList.getLength()-1;i>=0;i--){
    Element defect = (Element) defectList.item(i);
     String link=defect.getAttribute("rdf:resource");
     String id=link.substring(link.lastIndexOf("/")+1);
         if (id.equals(defectID))
     {
   
      defect.getParentNode().removeChild(defect); 
     
    //  doc.removeChild(defect);
   System.out.println("Removing defect "+ defectID);
   
     }
    
   
  }
  

0 votes


The question has been closed for the following reason: "Duplicate Question" by tmok Jul 23 '13, 2:49 p.m.


One answer

Permanent link
This is a duplicate, please see https://jazz.net/forum/questions/120412/issue-in-removing-a-node

0 votes

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Jul 22 '13, 3:21 p.m.

Question was seen: 7,217 times

Last updated: Jul 23 '13, 2:49 p.m.

Confirmation Cancel Confirm