Database Reference
In-Depth Information
If we were really clever, we would have understood that the XML doc class provided us with
useful methods all the way down! Try neurotically holding down the tab key after typing this:
> lat<-xmlResult$ (now hold down the tab key)
xmlResult$doc xmlResult$dtd
(let's go with doc and start looking for more methods using $)
> lat<-xmlResult$doc$
With enough experimentation, we can get all the way to the result we are looking for:
> lat<-xmlResult$doc$children$ResultSet$children
$Result$children$Latitude$children$text$value
> str(lat)
chr "39.951405"
We get the same usable result using raw data structures with helper methods, or internal object
methods. In a more complex or longer tree structure, we might have also used event-based or
XPath-style parsing to get to our value. You should always begin by trying the approaches that
you find most intuitive.
Search WWH ::




Custom Search