Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
XmlDataDocument problem: xmlns
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
johnpapa
20y
2.3k
1
Reply
Hello all, Im trying to manipulate a config file using XmlDataDocument. The config file is as follows:
I Want to be able to change the versioning informayion without affecting the rest of the file, so I use the following code: XmlDataDocument doc = new XmlDataDocument(); doc.Load(configFile); XmlNode temp = doc.FirstChild; while(!temp.Name.Equals("dependentAssembly")) { temp = temp.FirstChild; } XmlElement newNode = doc.CreateElement("bindingRedirect"); newNode.SetAttribute("oldVersion","0.0.0.0 - 9999.9999.9999.9999"); newNode.SetAttribute("newVersion",a[0].AssemblyVersion); temp.ReplaceChild(newNode, temp.LastChild); doc.Save(configFile); But, instead of getting:
, i get:
I really dont have a clue why this happens! And it only happens if the xmlns attribute exists in the assemblyBinding element of the xml document. Could someone please help? I have searched the internet so many times, but I couldn't find anything. As you can understand I don't know anything about xml. I just need to be able to replace this element. Any help will be greately appreciated! Thanx!
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Help....
C#, Crystal Reports... And a Custom Print Button ? Can it be done ?