Source Code : Java DOM edit: Locating a Node by Using Siblings
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Java DOM edit: Locating a Node by Using Siblings
public void LocatingUsingSibling(Document doc,String newname,String newemail) {
Element root = doc.getDocumentElement();
Element person = (Element)root.getFirstChild();
while(person != null) {
Element name = (Element)person.getFirstChild();
Text nametext = (Text)name.getFirstChild();
String oldname = nametext.getData();
if(oldname.equals(newname)) {
Element email = (Element)name.getNextSibling();
Text emailtext = (Text)email.getFirstChild();
emailtext.setData(newemail);
}
person = (Element)person.getNextSibling();
}
}
Thank with us