The problem is that in the desktop is working but NO in the ios simulator.
i have check in app settings to use the revXML.
i get the error "xmlerr, can't parse xml"
here is the code but i don't know where i do wrong
Code: Select all
[code]Global pUrl
global myarray
Global browserID
Global theUrl
global tTitles
global thehtmlFile
global theData
global Store_lng
Global Lat_lng
on preopencard
if the environment is not "mobile" then exit preopencard
# put the url into var and change the data test1,test2 with coordinates
put "http://maps.googleapis.com/maps/api/distancematrix/xml?origins=test1&destinations=|test2&mode=walking&language=el&key=" into testmap
# replace the data test1,test2
put replaceText(testmap, "test2[test2]*",""&store_lng) into testmap
put replaceText(testmap, "test1[test1]*",""&lat_lng) into testmap
#load the url
put Url testmap into pUrl
loadPreferences
end preOpenCard
--The XML Tree
command loadPreferences
local tTree
put readPreferencesToXMLTree() into tTree
if tTree is empty then
exit loadPreferences
end if
processPreferencesTree tTree
answer tTree
revDeleteXMLTree tTree
end loadPreferences
# This function reads the XML file, and turns it into an XML Tree. The tree is then returned
private function readPreferencesToXMLTree
local tPreferencesData, tResult
put pUrl into tPreferencesData
put the result into tResult
if tResult is not empty then
answer error "Failed to read preferences file at location: " & tPreferencesFile
return empty
end if
local tTree
put revCreateXMLTree(tPreferencesData, false, true, false) into tTree
if tTree is not an integer then
answer error "Failed to process preferences file with error: " & tTree
return empty
end if
return tTree
end readPreferencesToXMLTree
private command processPreferencesTree pTree
put revXMLNodeContents(pTree, "/DistanceMatrixResponse/origin_address") into torigin
put revXMLNodeContents(pTree, "/DistanceMatrixResponse/destination_address") into tDest
put revXMLNodeContents(pTree, "/DistanceMatrixResponse/row/element/duration/text") into tTime
put revXMLNodeContents(pTree, "/DistanceMatrixResponse/row/element/distance/text") into tMeters
set the unicodetext of fld "orig" to uniencode(torigin,"utf8")
set the unicodetext of fld "dest" to uniencode(tDest,"utf8")
set the unicodetext of fld "meters" to uniencode(tmeters,"utf8")
set the unicodetext of fld "time" to uniencode(ttime,"utf8")
end processPreferencesTree