Groups | Blog | Home
all groups > dotnet xml > may 2006 >

dotnet xml : How to rename an element?


W. Jordan
5/16/2006 12:00:00 AM
Hello,

Can I rename the name of an XmlElement?
I can't find any method or properties to do so in the .net 2.0 sdk.
Shall I duplicate the XmlElement's children and attributes
just in order to change its name?


--

Best Regards,
W. Jordan



Oleg Tkachenko [MVP]
5/16/2006 12:00:00 AM
[quoted text, click to view]

You can't rename element. That's W3C DOM standard. Just recreate it and
reappend its children.

--
Oleg Tkachenko [XML MVP, MCAD]
Martin Honnen
5/16/2006 2:26:22 PM


[quoted text, click to view]


[quoted text, click to view]

You need to create a new element with the desired named, then you need
to copy the attributes. There is no need to duplicate the children as
you can simply AppendChild them to the new element. Then you need to use
ReplaceChild to replace the original with the new element.

--

Martin Honnen --- MVP XML
W. Jordan
5/18/2006 12:00:00 AM
Thanks for all replies.
It seems that it is somewhat awkward.....
Why do they design like that?

--


Best Regards,
W. Jordan




[quoted text, click to view]

AddThis Social Bookmark Button