Sorry, do not append the new node as a child of the root node, append it as
a sibling (document.appendChild(newNode) instead of
docElement.appendChild(newNode)).

-----Original Message-----
From: Swanson, Brion [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 01, 2002 10:20 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Problem with the method renameNode again


It has been my understanding that one cannot change the name of the
root/document node since a node's name is critically important to the
structure of a node/DOM tree.

One suggestion would be to create a new node with the name you desire,
append the new node as a child of the root node, move all the subelements of
the former root node to the new node, then delete the former root node from
the DOM.

Brion Swanson

-----Original Message-----
From: sire chembiparambil [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 01, 2002 10:15 AM
To: [EMAIL PROTECTED]
Subject: RE: Problem with the method renameNode again



I was able to get rid of the nullpointerexception by passing in a an empty
string in place of the null obj for namespaceuri param.

((org.apache.xerces.dom.DocumentImpl)doc).renameNode(tree, null, tagName);

change to

((org.apache.xerces.dom.DocumentImpl)doc).renameNode(tree, "", tagName);

But, the expected result of having the root node(hello) name change does
not happen. The child node(bye) name does change though ???

Sire Chembiparambil
   IBM Global Services, AT&T ADM Account
  Tel : 732.420.0657
  E-mail : [EMAIL PROTECTED]



Sauquet Dominique <[EMAIL PROTECTED]> on 10/01/2002 03:19:31 AM

Please respond to [EMAIL PROTECTED]

To:    "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc:
Subject:    RE: Problem with the method renameNode again



Unfortunately, there is no change.
I still get a Null Pointer Exception
 Dominique

-----Message d'origine-----
De : sire chembiparambil [mailto:[EMAIL PROTECTED]
Envoy� : lundi 30 septembre 2002 16:27
� : [EMAIL PROTECTED]
Objet : Re: Problem with the method renameNode again




Try using the Node obj returned as a result of the rename() operation.

((org.apache.xerces.dom.DocumentImpl)doc).renameNode(tree, null, tagName);
System.out.println(" #### after renameNode");

change this to be like

tree = ((org.apache.xerces.dom.DocumentImpl)doc).renameNode(tree, null,
tagName);
System.out.println(" #### after renameNode");

I havent tried this out, just a thought.

Sire Chembiparambil




Sauquet Dominique <[EMAIL PROTECTED]> on 09/30/2002 09:51:37 AM

Please respond to [EMAIL PROTECTED]

To:    [EMAIL PROTECTED]
cc:
Subject:    Problem with the method renameNode again



Hello

I resend a mail that I previously sent on last friday since
I am puzzled by the very few mails we have from this mailing
list that is generally so active.

The problem is :

I tried to use the method renameNode of the class
org.apache.xerces.dom.DocumentImpl
The node is effectively renamed but I generate an exception :
NullPointerException.

Please can you explain me what happens ?
is it a misuse ?
can I do otherwise ?

I attach a test file.
You can test it by launching java TestClass

 <<TestClass.class>>  <<TestClass.java>>

ps : I tried another method much more complex where a replaceChild is used
but does not work when I want to change the tag name of the root !!

Thanks a lot


> Dominique Sauquet
> Direction des Moyens Informatiques
> Tel : 01 46 84 13 12
> <mailto:[EMAIL PROTECTED]>
>
> Prosodie
> 150, rue Galli�ni
> 92100 Boulogne
> <http://www.prosodie.com/>
>
>
>


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





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

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






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

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

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

Reply via email to