Click here to Skip to main content
15,905,963 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone.

First of all, excuse my english, i'll try to explain the question the best i can.

I'm a beginner in programation an i need help in a proyect.
I've been searching on the internet about how to rename the ID of the XML nodes but i didn't find what i need.

For example: if i have the Node "Monday" and the ID "1" and i want to change it for
the ID "48" or "Mon".

Is it possible, are there any function or library in c# to do it?

If anyone knows how to do it i'll be very grateful.

Thanks and regards from Spain¡
Posted

1 solution

try this
C#
var doc = XDocument.Load("test.xml");
doc.Root.Element("MONDAY").Attribute("ID").Value = "new value";
doc.Save("test.xml");

Hope this helps
 
Share this answer
 
Comments
Acusu 6-Aug-13 7:08am    
Thank you very much. It helped me, but i was looking for something that could change the nodes ID too.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900