954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Seeking Advice - XML

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?

XPath?
XSLT?
XMLReader/XMLWriter?

My Code/XML contents cannot be posted though.

MikeyIsMe
Junior Poster
142 posts since Nov 2010
Reputation Points: 32
Solved Threads: 15
 

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.

thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

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.

ChrisHunter
Posting Whiz in Training
276 posts since Feb 2011
Reputation Points: 36
Solved Threads: 28
 

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

MikeyIsMe
Junior Poster
142 posts since Nov 2010
Reputation Points: 32
Solved Threads: 15
 

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

thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

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

MikeyIsMe
Junior Poster
142 posts since Nov 2010
Reputation Points: 32
Solved Threads: 15
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: