Вопрос

I am trying to make an API call to google places and google returns an XML document with multiple fields and lines of data. What is the best way to take that data, select specific nodes from it, and put it into a dataset?

Here is an example of my API call with control parameters passed into the API call:

("https://maps.googleapis.com/maps/api/place/search/xml?location=" _ & lat & "," & lng & "&radius=5000&keyword=" & Replace(searchvenuenametextbox, " ", "+") _ & "&sensor=false&key=" & googleapikey)

The best way to do this is preferred.

Это было полезно?

Решение

LINQ is the easiest way to do that. query the XML , just taking out the elements that you want then they can be easily inserted into DataTable

Другие советы

Here's a walkthrough that describes how to read Xml into a Dataset: Walkthrough: Reading XML Data into a Dataset

The walkthrough doesn't describe how to omit fields from the Xml prior to adding to your Dataset, however you can use (or not use for that matter) whatever fields you want/don't want from your Dataset.

As for the best way - that's up for debate I suppose.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top