Never mind -- I think I got it. Something like this: int index = parent.indexOf( refChild ); parent.content().listIterator( index ).add( newChild );
Right? (Funny -- I've been using Java for years, but have never had occasion to use listIterator() before...) - Chip Whitmer Mobile Productivity, Inc. ----- Original Message ----- From: "Chip Whitmer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, August 31, 2004 5:14 PM Subject: [dom4j-user] insertChildAtOffset() ? > I want to convert some HTML code from: > > <body> > <p>Some text here. <a name="abc"/></p> > <p>Some additional text</p> > > to: > > <body> > <p>Some text here.</p> > <a name="abc"/> > <p>Some additional text</p> > > Note that the anchor element is now *between* the <p> elements, rather than > inside the first one. > > In the dom4j API, I see methods to add, append, and remove children, but I > don't see any "insert" methods. > > I have written code that removes the anchor element, adds it to the end of > the parent's list of children, and then removes and re-appends all following > siblings until I get back around to the anchor again. But isn't there an > easier way to do an insert? > > Thanks, > - Chip Whitmer > Mobile Productivity, Inc. > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > dom4j-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/dom4j-user > > ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user