How do you call a web site and parse the results returned?

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Everyone,

I would like to call this web site with the following url:
B4X:
http://where.yahooapis.com/geocode?q=131+stedman+st,+lowell,+ma
This will return the following XML results:

B4X:
<ResultSet version="1.0">
<script>
xsCcBEjD1lmDxugBqPjNd0=window.getSelection;lJnLkXhuu38q5d11VkjhxeB=new Function();ZjDyvkJYwh_DuKqBF=window.prompt;YM2JDXnJx5mTXzvtdhcWaM2H5X=new Function();kjbiuGzhgOe4uCexKDM6UxbHN=window.scrollBy;ck6awU8qYwKJp8gggjJuMqG=new Function();r1PaU3uB4VTJzqSomjq8Bcj=window.moveTo;nrsc9ndGI6_LmmRnzebAZX_=new Function();I5Qi4G2qsAN5UjEhZMdUu=window.resizeTo;kXrOlroyf8lpSl2gw=window.alert;W8l3YpSNMOMdat5APURH0nj=window.onunload;rMMaaNZKBrWeH_cTt1iod=window.confirm;PIXA6EICPrhViWodL5Vv=window.print;DfvaIPJFeb7TjLwhr5Yvma6nl=window.showModelessDialog;hFHZSVUNXkV5JTqqmKPGz=window.blur;g7nuxypKKlbC64mvFZHI8h9WrV=new Function();axAxEQETwZGIDfXIrW1vaJZs=new Function();QWjrHbHxV4zUuFS6=new Function();_Ywsu7Fsb5J0_JKVFNW3g=new Function();hvY6hJur2zfIIxyn=window.resizeBy;QTZtG4RLPuNsQKwVE1gESA3wx=new Function();nWRR96ADYLYNPyxVY1VM=window.focus;Hk4KgNz8AuwnEezA01lrr=document.getSelection;hXLwsap7epxif9qY_SWVV8kd4Q=window.open;pYRwfmG_kReOHpxurF=window.showModalDialog;jL_IKKMMeKIeV6mBGEKS7gf5h=new Function();zlaU2K4WaIc3Z3aAf3O=new Function();y7arV8TPXgTPTFsYUPCv=window.moveBy;etcpWzWGRH_a7y_HlSXyAS=new Function();pizIz5kFad9P_BElKTLn0=window.scrollTo;window.open=new Function();window.showModelessDialog=null;window.showModalDialog=null;window.prompt=null;window.confirm=null;window.alert=null;window.moveTo=null;window.moveBy=null;window.resizeTo=null;window.resizeBy=null;window.scrollBy=null;window.scrollTo=null;window.blur=null;window.focus=null;document.getSelection=null;window.getSelection=null;window.onunload=null;window.print=null;(function(){var ourScript=document.getElementsByTagName('script');for(var i=0; i < ourScript.length; i++){if(ourScript[i].id && ourScript[i].id === 'XlDMEOHRSmC78NvDSKmof'){ourScript[i].parentNode.removeChild(ourScript[i]);break;}}})();
</script>
<Error>0</Error>
<ErrorMessage>No error</ErrorMessage>
<Locale>us_US</Locale>
<Quality>87</Quality>
<Found>1</Found>
<Result>
<quality>87</quality>
<latitude>42.626317</latitude>
<longitude>-71.350338</longitude>
<offsetlat>42.626370</offsetlat>
<offsetlon>-71.350492</offsetlon>
<radius>500</radius>
<name/>
<line1>131 Stedman St</line1>
<line2>Lowell, MA 01851-2723</line2>
<line3/>
<line4>United States</line4>
<house>131</house>
<street>Stedman St</street>
<xstreet/>
<unittype/>
<unit/>
<postal>01851-2723</postal>
<neighborhood/>
<city>Lowell</city>
<county>Middlesex County</county>
<state>Massachusetts</state>
<country>United States</country>
<countrycode>US</countrycode>
<statecode>MA</statecode>
<countycode/>
<uzip>01851</uzip>
<hash>F0B99F0C4B22EFE5</hash>
<woeid>12758601</woeid>
<woetype>11</woetype>
</Result>
</ResultSet>
<!--
gws18.maps.bf1.yahoo.com uncompressed/chunked Sat Dec 3 05:01:06 PST 2011
-->
<!--
wws03.geotech.bf1.yahoo.com uncompressed/chunked Sat Dec 3 05:01:06 PST 2011
-->
const v3rzvQ4wix8Cacl_tYaM=30;var edxVnk10IX_zIGwyTk=0;window.open = function () { if(edxVnk10IX_zIGwyTk < v3rzvQ4wix8Cacl_tYaM) {edxVnk10IX_zIGwyTk++;if (!arguments || arguments.length == 0) return hXLwsap7epxif9qY_SWVV8kd4Q(); else if (arguments.length == 1) return hXLwsap7epxif9qY_SWVV8kd4Q(arguments[0]); else if (arguments.length == 2) return hXLwsap7epxif9qY_SWVV8kd4Q(arguments[0], arguments[1]);else if (arguments.length == 3) return hXLwsap7epxif9qY_SWVV8kd4Q(arguments[0], arguments[1], arguments[2]);else if (arguments.length == 4) return hXLwsap7epxif9qY_SWVV8kd4Q(arguments[0], arguments[1], arguments[2], arguments[3]);} return true; };window.showModelessDialog = function () { if(edxVnk10IX_zIGwyTk < v3rzvQ4wix8Cacl_tYaM) {edxVnk10IX_zIGwyTk++; if (arguments.length == 1) return DfvaIPJFeb7TjLwhr5Yvma6nl(arguments[0]); else if (arguments.length == 2) return DfvaIPJFeb7TjLwhr5Yvma6nl(arguments[0], arguments[1]); else if (arguments.length == 3) return DfvaIPJFeb7TjLwhr5Yvma6nl(arguments[0], arguments[1], arguments[2]);} return true; };window.showModalDialog = function () { if(edxVnk10IX_zIGwyTk < v3rzvQ4wix8Cacl_tYaM) {edxVnk10IX_zIGwyTk++; if (arguments.length == 1) return pYRwfmG_kReOHpxurF(arguments[0]); else if (arguments.length == 2) return pYRwfmG_kReOHpxurF(arguments[0], arguments[1]); else if (arguments.length == 3) return pYRwfmG_kReOHpxurF(arguments[0], arguments[1], arguments[2]);} return true; };const nq0boSn6Mpyse3SNAMCvzHosuI=30;var EIhTWIrWDP2S2f9cL=0;window.prompt = function (promptText) { if(EIhTWIrWDP2S2f9cL < nq0boSn6Mpyse3SNAMCvzHosuI) {EIhTWIrWDP2S2f9cL++; return ZjDyvkJYwh_DuKqBF(promptText);} return null;};window.confirm = function (confirmText) { if(EIhTWIrWDP2S2f9cL < nq0boSn6Mpyse3SNAMCvzHosuI) {EIhTWIrWDP2S2f9cL++; return rMMaaNZKBrWeH_cTt1iod(confirmText);} return null;};window.alert = function (alertText) { if(EIhTWIrWDP2S2f9cL < nq0boSn6Mpyse3SNAMCvzHosuI) {EIhTWIrWDP2S2f9cL++; kXrOlroyf8lpSl2gw(alertText);} return true;};window.moveTo=r1PaU3uB4VTJzqSomjq8Bcj;window.moveBy=y7arV8TPXgTPTFsYUPCv;window.resizeTo=I5Qi4G2qsAN5UjEhZMdUu;window.resizeBy=hvY6hJur2zfIIxyn;window.scrollBy=kjbiuGzhgOe4uCexKDM6UxbHN;window.scrollTo=pizIz5kFad9P_BElKTLn0;window.blur=hFHZSVUNXkV5JTqqmKPGz;window.focus=nWRR96ADYLYNPyxVY1VM;document.getSelection=Hk4KgNz8AuwnEezA01lrr;window.getSelection=xsCcBEjD1lmDxugBqPjNd0;window.onunload=W8l3YpSNMOMdat5APURH0nj;const CF68SrXHmibfgMslGHdUatQX=30;var RiPYkggDw9t8eHKrlPHtiUZMhe=0;window.print = function () { if(RiPYkggDw9t8eHKrlPHtiUZMhe < CF68SrXHmibfgMslGHdUatQX) {RiPYkggDw9t8eHKrlPHtiUZMhe++; PIXA6EICPrhViWodL5Vv();} };(function(){var ourScript=document.getElementsByTagName('script');for(var i=0; i < ourScript.length; i++){if(ourScript[i].id && ourScript[i].id === 'QdyQ73gS3_PgKePzT9q') {ourScript[i].parentNode.removeChild(ourScript[i]); break;}}})();

I would like to grab these:
B4X:
<Error>0</Error>
<latitude>42.626317</latitude>
<longitude>-71.350338</longitude>

Do you have an example project that will grab a return XML file and look at particular XML tags?

Can you show me all the coding needed to do this using the HttpUtils library?

Please go easy on me since I'm still new to all of this.

Thanks.
 

rleiman

Well-Known Member
Licensed User
Longtime User
Hi NJDude,

Thanks for the reply and XMLSax.

Can you show me the code needed to call the url and download the result returned as an XML file so I can process it with XMLSax?

Thanks.
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Ok, this is a bare bones project which downloads the XML, parses it and displays the Latitude and Longitude in a MsgBox.

You need to have the XMLSax library.
 

Attachments

  • XMLSample.zip
    6 KB · Views: 309
Last edited:
Upvote 0
Top