How can I change an attribute of an element in an XML file, using C#?
相关问题
- Sorting 3 numbers without branching [closed]
- Illegal to have multiple roots (start tag in epilo
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
Using LINQ to xml if you are using framework 3.5:
Here's the beginnings of a parser class to get you started. This ended up being my solution to a similar problem:
If the attribute you want to change doesn't exist or has been accidentally removed, then an exception occurs. I suggest you first create a new attribute and send it to a function like the following:
Usage:
Mike; Everytime I need to modify an XML document I work it this way:
I hope you find it useful