W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2001

Re: Help please! Problem with insertBefore

From: <Joseph_Kesselman/Watson/IBM%LOTUS@lotus.com>
Date: Thu, 14 Jun 2001 13:42:49 -0400 (EDT)
To: <www-dom@w3.org>
Message-ID: <OF26F08114.FEA3039A-ON85256A6B.00608E70@lotus.com>

>My XML file has a root element called "fanml" and a container element for
each new entry called "news".

In other words,
     <fanml>
          <news/>
          <news/>
     </fanml>

>insert my new news elements before my old ones?

     Element fanml=myDocument.getDocumentElement();
     //...
     Element firstNews=fanml.getFirstChild();
     fanml.insertBefore(myNewNews,firstNews);

Or

     //...
     firstNews=myDocument.getElementsByTagName("news").item(0);
     firstNews.getParent().insertBefore(myNewNews,firstNews);

Or anything equivalent...



______________________________________
Joe Kesselman  / IBM Research
Received on Thursday, 21 June 2001 10:43:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:48 GMT