Question

I need to process information from an XML-like file. Does anyone know some library/inbuild class (preferably c#) which might be useful to deal with that type of document (with not much effort) ?

Below is a piece of the XML :

<query>
  <type id="excel" />
  <ids>
    <id value="47" />
    <id value="2067" />
    <id value="247" />
    <id value="329" />
    <id value="19" />
    <id value="485" />
    <id value="148" />
    <id value="203" />
    <id value="219" />
    <id value="1503" />
    <id value="7318" />
  </ids>
  <period value="Monthly" />
  <start month="01" year="1990" />
  <end month="12" year="2015" />
</query>
Was it helpful?

Solution 2

Welcome to StackOverflow :D

There are 2 tools that should help you in dealing with it :

  • XSD.EXE will generate a schema and classes that you can add to your project
  • XSD2Code will generate classes from a schema as well as Serialize/Deserialize methods

Suggestion :

Use XSD.EXE to generate your schema then use XSD2Code to generate classes from that schema.

Both tools are free,

The first one you access it through the Developer Command Line :

xsd file.xml

enter image description here

The second one is a Visual Studio add-in : (tutorial on their site)

enter image description here

Do not forget to accept the answer if you are satisfied with it or ask for more details by editing your question.

OTHER TIPS

This appears to be a perfectly valid XML file.

There are System.Xml.XmlDocument class and System.Xml.Linq.XDocument class, both deal with parsing (and constructing) XML.

You can also build a class model and then use XmlSerializer class to deserialize the xml into a class hierarchical model instance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top