Skip to content

Instantly share code, notes, and snippets.

@codenameone
Created March 3, 2016 05:03
Show Gist options
  • Save codenameone/966f9061a610330f5d03 to your computer and use it in GitHub Desktop.
Save codenameone/966f9061a610330f5d03 to your computer and use it in GitHub Desktop.
Sample usage of the XPath processing package in Codename One
Result result = Result.fromContent(input, Result.XML);
String country = result.getAsString("/result/address_component[type='country']/long_name");
String region = result.getAsString("/result/address_component[type='administrative_area_level_1']/long_name");
String city = result.getAsString("/result/address_component[type='locality']/long_name");
@codenameone
Copy link
Author

This sample was designed to work with this gist https://gist.github.com/codenameone/6470330d1a30d30760ed

Sample code for using the Result class.

From the Codename One project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment