Find the ATM closest to your home with pureXML

I was looking for a branch of ScotiaBank in Markham. Tried their website and – I don’t know if it’s down or if it’s just me – but couldn’t really find the information! In the bottom however I did notice this link saying Branch Locations and I decided to give it a try:

Now I had a copy of all the branches in GPX 1.1, which is pretty useful but quite boring to just text search.

So I decided to use pureXML to do the work for me. I didn’t want to have to create a new database / table / etc so for the sake of saving time I decided to use the pureXML Industry Demo, which happens to support GPX. After inserting the document – added schema validation just to test it – I could now query the data and retrieve what I want using either XQuery or SQL/XML. According to that page all the XML documents are stored in a XML Column named DOCUMENT in the GPX table. So now I just need to translate to XQuery something like “get me all the ScotiaBank branches that are in Markham”. As I’m not really interested in creating elaborate spatial queries but just in getting things done I decided a simple text search would suffice.

XQuery
  declare default element namespace "http://www.topografix.com/GPX/1/1";
  for $branch in db2-fn:xmlcolumn('GPX.DOCUMENT')/gpx/wpt
  where $branch/name/contains(.,'MARKHAM')
  return $branch

And now here are the ScotiaBank branches that exist in Markham:

Enough for me. I got the addresses and phone numbers, I can now go to google maps and check it out. However if the amount of data was significant you could use XQuery / XSLT / Yahoo Pipes / etc to transform the data into KML and load it up automatically either in any map viewer of your choice.

Leave a Reply