I currently need to be able to read through an XML document, find certain nodes and either delete them (and child nodes) or edit the nodes name and possibly value. What would be the best way of going about this?


My Code/XML contents cannot be posted though.

Recommended Answers

All 5 Replies

The easiest way I've found is to use the "System.Xml.Linq" namespace so you can use XDocument.Load() on your file or page. Even if you don't use any actual Linq, the methods in that namespace seem to be easier to use than others.

I would suggest doing it the way thines01 has suggested. Take a look at this. there's plenty of examples floating about just do a quick search and you'll find them.

Hmm interesting :) was half expecting either XSLT or XPath as those are what the guys at work are suggesting looking into.

Personally im already hating XML :D

It's JUST another thing.
There are worse things :)

Hehe fair enough, thanks for the input lads :) Now to spend hours trawling tutorials!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.