-3

This is the following link to the XML I am trying to read in c#.

http://randomspam.co/INFO/103000000.img.xml

I need to know how to retrieve the following values of the names: width, height, centerX, & centerY and put each one into its respective INT.

<imgdir name="miniMap">
<int name="width" value="3966"/>
<int name="height" value="1676"/>
<int name="centerX" value="2343"/>
<int name="centerY" value="1318"/>

How would I make a class and a function to retrieve the values I need above, so I am able to call it anytime with any other ID (ex. 103000000).

Thanks as I have no clue on how to read XML files.

Andrew
  • 552
  • 2
  • 10
  • 29
  • possible duplicate of [How does one parse XML files?](http://stackoverflow.com/questions/55828/how-does-one-parse-xml-files) – Alexei Levenkov Mar 12 '14 at 20:19
  • This one gives you a little more as far as examples. http://stackoverflow.com/questions/566167/query-an-xdocument-for-elements-by-name-at-any-depth – Bearcat9425 Mar 12 '14 at 20:20
  • 1
    -1: please make sure to use search before asking question. It is not very hard to find samples of reading XML or loading XML/any other file from remote server. Feel free to update your question with more details of what does not work (or at least what you tried to search for) so more concrete help can be provided. – Alexei Levenkov Mar 12 '14 at 20:21
  • [LINQ TO XML](http://msdn.microsoft.com/en-us/library/bb387087.aspx) – Selman Genç Mar 12 '14 at 20:22
  • Almost any Google search would have helped. This is not a useful Stackoverflow question. – Thomas Weller Mar 12 '14 at 20:22

1 Answers1

1

You might want to try out Serialization and Deserialization. Check it out if this simplifies your task.

Another Simplified example for an idea. Hope these help you out.

TechnoBrat
  • 277
  • 1
  • 7