W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2000

renaming nodes or changing node's name

From: CLECH Armelle FTRD/DMI/LAN <armelle.clech@rd.francetelecom.fr>
Date: Wed, 8 Nov 2000 14:46:03 +0100
Message-ID: <CDE201D3CAB3D411955B00062938239E44232E@l-mhs2.lannion.cnet.fr>
To: "'www-dom@w3.org'" <www-dom@w3.org>
Hello,

	I'm trying to change the name of some node. I can not succeed. I
didn't find any setNodeName(String ). 
So I tried the following code where I create a new node to which I append
attributs removed from old node>
I get an exception (on the removal of attribut) with the message : DOM008
not found ???

What does mean this message ?
How can I make my code works ?

thanks for help.

            itemList = doc.getElementsByTagName("spec_itemid");
	for(int i=0;i<itemList.getLength();i++)
	    {
		Node  item = itemList.item(i);
		Node parent = item.getParentNode();
		Element newNode = doc.createElement("liste_item_id");
		parent.appendChild(newNode);
		showEntireDoc(doc);
		if(item.getNodeType()==Node.ELEMENT_NODE)
		    {
		    NamedNodeMap listAtt= item.getAttributes();
		    if(listAtt!=null)
			{
			    for(int a=0;a<listAtt.getLength();a++)
				{
				    Node att = listAtt.item(a);
	
listAtt.removeNamedItem(item.getNodeName());
				    newNode.appendChild(listAtt.item(a));
				}
			}
		    }
		parent.removeChild(item);
	    }

Armelle CLECH

 france télécom R&D / DMI /GRI
technopole Anticipa                       email:
armelle.clech@rd.francetelecom.fr
2, Avenue Pierre Marzin                            	   Téléphone (33) 2
96 05 07 52
22307        Lannion Cedex                         	   Télécopie  (33) 2
96 05 32 86
Received on Wednesday, 8 November 2000 08:49:22 GMT

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