BattlFrog
BattlFrog

Reputation: 3397

How to Work with XML in .NET?

I may get my terminology wrong here, because I have never worked with APIs, XML or Web Services. I am creating an MVC app, and a small section requires functionality to send info to a remote server, which sends an XML response. The response looks something like:

<VISResponse>
<ResponseType>resultsList</ResponseType>
<Matches>1</Matches>
<SessionID>9efa7c0cc9860f108190cc8e933095cf</SessionID>
<RecStart>1</RecStart>
<ClientCode/>
<Results/>
</VISResponse>

I need to do stuff with that response, like display it in a view, in a form readable to the user, and I need to store the sessionId for later use. I have been researching and found some indications of an xml class, but have yet to find a good tutorial. Can some one direct me?

Upvotes: 0

Views: 282

Answers (1)

Sina Iravanian
Sina Iravanian

Reputation: 16286

LINQ to XML has the nicest API. Start with XDocument.Load or XElement.Parse and you'll figure out other methods you'll need to call.

You may find this a good start point, or this CodeProject Article.

Upvotes: 3

Related Questions