Jake Memery

Jake Memery

  • NA
  • 2
  • 3k

Read and transform multiple XML files with XSLT

Nov 30 2012 3:06 AM
Hi Guys,

This may be a very basic question / query, so please excuse my lack of experience:

I'm trying to write a simple Windows Forms application that allows me to select a directory full of .XML files (some .SGM files but they structured in exactly the same way but without the xml declaration), then select an XSLT stylesheet, and run the stylesheet against all the .XML files, generating seperate files for each .XML file.

I'm fumbling my way though the necessary code by cobbling together various online examples(i'm new to C# and programming) but i'm wondering which is best to use for what i'm trying to achieve:

XmlDocument
XmlReader
XmlTextReader
XDocument

There is obviously lots of info online about each, but i can't find an obvious preferred choice between them for what i'm doing. As i understand it XDocument is the newer class, but this doesn't necessarliy make it the best choice for me i guess. I'm potentially going to be working with several hundred .xml files but speed is not vitally important. Simplicity is though.

I'm not interested in parsing the files against a DTD as this will be taken care of prior to XSLT transformation.

Any info / pointers relating to my specific goal would be much appreciated. Thanks.

Jake