I've created a couple simple enhancements to the ticpp API that make
using the library a lot easier for querying simple REST services.
This makes accessing data from, for example, the Yahoo Geocoding API,
much simpler. See the example below.
Any interest in such a contribution?
I see that Matt Trentini has a branch where he is working on something
similar, but there hasn't been much activity of late. What you see
below was done with the addition of a few operator[], operator() and
string conversion methods. Matt's work appears to be a little more
ambitious, attempting to simplify the syntax for both the querying and
construction of XML.
// Sample output can be found here:
// http://developer.yahoo.com/maps/rest/V1/geocode.html
int main()
{
ticpp::Document doc;
try
{
std::ostringstream os;
curlpp::Cleanup myCleanup;
os << curlpp::options::Url(URL);
doc.Parse(os.str());
std::string lat = doc["ResultSet"]["Result"]["Latitude"];
std::string lng = doc["ResultSet"]["Result"]["Longitude"];
std::cout << " Latitude: " << lat << std::endl;
std::cout << "Longitude: " << lng << std::endl;
std::cout << "Precision: " << doc["ResultSet"]["Result"]
("precision")
<< std::endl;
}
catch (std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
return 0;
}
Regards,
Rob
--
You received this message because you are subscribed to the Google Groups "TinyXML++" group.
To post to this group, send email to ti...@googlegroups.com.
To unsubscribe from this group, send email to ticpp+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ticpp?hl=en.