E
Emmanuel
I am trying to use the method from the dom4j Library to insert new
element it to an existing xml but I keep getting an error. Is any one
familiar with the dom4j Library? I need help. I am new to Dom4j.
Inserting elements sometimes it's necessary to insert an element in a
existing XML Tree. This is easy to do using dom4j Collection API.
Need help thanks
public void insertElementAt(Element newElement, int index) {
Element parent = this.element.getParent();
List list = parent.content();
list.add(index, newElement);
}
public void testInsertElementAt() {
//insert an clone of current element after the current element
Element newElement = this.element.clone();
this.insertElementAt(newElement,
this.root.indexOf(this.element)+1);
// insert an clone of current element before the current element
this.insertElementAt(newElement,
this.root.indexOf(this.element));
}
element it to an existing xml but I keep getting an error. Is any one
familiar with the dom4j Library? I need help. I am new to Dom4j.
Inserting elements sometimes it's necessary to insert an element in a
existing XML Tree. This is easy to do using dom4j Collection API.
Need help thanks
public void insertElementAt(Element newElement, int index) {
Element parent = this.element.getParent();
List list = parent.content();
list.add(index, newElement);
}
public void testInsertElementAt() {
//insert an clone of current element after the current element
Element newElement = this.element.clone();
this.insertElementAt(newElement,
this.root.indexOf(this.element)+1);
// insert an clone of current element before the current element
this.insertElementAt(newElement,
this.root.indexOf(this.element));
}