[jdom-interest] insertBefore : again

Cédric Dumetz cedric at service-internet.com
Thu Feb 28 09:28:10 PST 2002

Sorry, i'm explain badly.
All I want is to add a Node before another one in some case.
Example when I've got :
        <element 1>
        </element 1>
I would like to have :
        <element 1>
            <a href='somwhere'>click here</a>
        </element 1>
Sorry again, but it makes 2 years that I don't deal with DOM, and the last time it was with Xerces.
To finish, if you think I am not in the good place in this list I will go away.
Sorry, really sorry

-----Message d'origine-----
De : Bart Read [mailto:bart at wdi.co.uk]
Envoyé : jeudi 28 février 2002 18:04
À : Cédric Dumetz; jdom-interest at jdom.org
Objet : Re: [jdom-interest] getElementsByTagName + insertBefore

Right, stop and think about this.  You're not adding <a href="whatever"> before your <img> element because the <a> element will ENCLOSE <img> like so:
<a href="whatever"><img src="somethingelse"/></a>
See?  So <a> becomes the parent of <img> so you need to remove <img> from the list and replace it with <a> and add <img> as a child element of <a>.  Seriously, check out the documentation and read Java and XML by Brett McLaughlin and Jason Hunter -- it won't take long and it'll save you a shedload of time in the long run. ;-)
Bart Read
Senior Developer
Abbotsbury Software Ltd
Abbotsbury, DORSET DT3 4JT
Tel: +44 (0) 1305 871543
E-mail: bart at wdi.co.uk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20020228/11a1301d/attachment.htm

More information about the jdom-interest mailing list