[jdom-interest] getElementsByTagName + insertBefore

Cédric Dumetz cedric at eolas.fr
Thu Feb 28 08:06:28 PST 2002

Sorry for my ignorance
I finally do a function like this
private static List getElementsByTagName(String name, Element elem) {
 Vector v = new Vector(elem.getChildren(name));
 for (Iterator it=elem.getChildren().iterator(); it.hasNext(); ) {
  v.addAll(getElementsByTagName(name, (Element)it.next()));
 return v;
and in my code I do this call :
    Element root = doc.getRootElement();
    List myIMG = getElementsByTagName("IMG", root)
Now I have another problem : how to insert an Element before another because I would like to insert a <a href> tag before each <img> tag (I found all the <img> tags with my method 'getElementsByTagName')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20020228/ac5a25d2/attachment.htm

More information about the jdom-interest mailing list