¿Cómo recuperar y mostrar XML?

Well the problem is that I am new to asp.net technology and I am stuck on a problem.

Now the scenario is that I have to send an HTTPrequest to another server from my page, lets say myGames.aspx and in response to the request the server sends me an XML file. Now I don't know how to handle this situation, I mean I am like a total noob :(

Also I don't have just to display the data, I have to send different fields of the XML to different databse tables, but thats a later issue, I'd first like to do some practice with the XML data just on screen before involving in sending it to database.

preguntado el 02 de febrero de 12 a las 10:02

3 Respuestas

To play with the XML data if you are using .net version 3.5 its better to user LINQ a XML.

http://www.codeproject.com/Articles/24376/LINQ-to-XML

or

Manipular datos XML con XPath y XmlDocument (C #)

Respondido 02 Feb 12, 14:02

yeah I m using .NET version 4, thanks I will take a look at it - Muhammad Mamoor Khan

but the problem is that I don't know how to capture or catch the XML file after sending an WebRequest :( - Muhammad Mamoor Khan

if you are get response Xml as URL Format than u can load like aquí

and get xml element nodes element or you can also filter linq query using below link

http://www.techrepublic.com/blog/programming-and-development/access-xml-data-using-linq-to-xml/594

Hops some helps.

contestado el 23 de mayo de 17 a las 15:05

There's several options:

You could query the data using Linq a XML y XDocument class. This is recommended if using .NET 3.5 or above.

You could load the data into an XmlDocument clase usando el LoadXml método y uso XPath to SelectSingleNodes para mostrar.

Podrías usar un XmlReader and read the document by looping over the nodes

contestado el 23 de mayo de 17 a las 14:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.