-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTestEniroGeocode.js
More file actions
34 lines (34 loc) · 1.55 KB
/
TestEniroGeocode.js
File metadata and controls
34 lines (34 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
Sample script for Infor Smart Office to validate an address with Eniro Geocode.
http://www.krakmapapi.dk/20120410enirogetapidocumentation.pdf
PENDING: error handling + background thread + user interface
*/
import System.Web;
import System.Xml;
package MForms.JScript {
class TestEniroGeocode {
public function Init(element: Object, args: Object, controller : Object, debug : Object) {
var address: String = "Borgarfjordsg, KISTA";
var url: String = "http://map.eniro.se/api/geocode?type=any&contentType=xml&name=" + HttpUtility.UrlEncode(address);
var doc: XmlDocument = new XmlDocument();
doc.Load(url);
var locations: XmlNodeList = doc.SelectNodes("//locations");
for (var location: XmlNode in locations) {
debug.WriteLine(
location.SelectSingleNode("addressId").InnerText + ", " +
location.SelectSingleNode("locationType").InnerText + ", " +
location.SelectSingleNode("roadname").InnerText + ", " +
location.SelectSingleNode("housenumber").InnerText + ", " +
location.SelectSingleNode("placename").InnerText + ", " +
location.SelectSingleNode("zip").InnerText + ", " +
location.SelectSingleNode("postarea").InnerText + ", " +
location.SelectSingleNode("city").InnerText + ", " +
location.SelectSingleNode("municipality").InnerText + ", " +
location.SelectSingleNode("municipalityId").InnerText + ", " +
location.SelectSingleNode("country").InnerText + ", " +
location.SelectSingleNode("placementCoordinate/y").InnerText + ", " +
location.SelectSingleNode("placementCoordinate/x").InnerText);
}
}
}
}