> -----Message d'origine-----
> De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Envoye : lundi 12 mars 2001 15:46
> A : [EMAIL PROTECTED]
> Objet : Re: setNodeName() ?
>
>
>
> Laurent Foret wrote:
>
> > It works fine, thanks ,
> > But if the Element is the root of the Document What is the parent?
> >
>
> The document would be the parent. In this case, you should switch the last
> two lines like this:
>
>      parent.removeChild(el);
>      parent.insertBefore(nel, null);
>

that's it, thanks.

On the same model, I have a renameAttribute() method :

private Node renameAttribute(Attr att, String newName) {
    // on cree l'element avec un nouveau nom.
    Attr natt = att.getOwnerDocument().createAttribute(newName);
    natt.setNodeValue(att.getNodeValue());

    Element owner = att.getOwnerElement();
    // on remplace l'ancien attribut par le nouveau
    NamedNodeMap attrs = owner.getAttributes();
    attrs.removeNamedItem(att.getNodeName());
    attrs.setNamedItem(natt);
    return (Node) natt;
  }

But, it seems that my method doesn't respect the order attributes in
NamedNodeMap.
Does it matter ?

---------------------------------------------------------
Laurent Foret
Service developpement

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

www.korom.net <http://www.korom.net>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to