Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / October 2006

Tip: Looking for answers? Try searching our database.

dom4j help

Thread view: 
Emmanuel Ayanrinola - 23 Oct 2006 21:05 GMT
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));
   }
KosciaK - 24 Oct 2006 19:54 GMT
Wychylając kolejny kieliszek Emmanuel Ayanrinola wymamrotał(a) co następuje:

> Need help thanks

Check out my answer on pl.comp.lang.java

Greetings!
KosciaK


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.