- var nodeName = hits[i].childNodes[j].nodeName;
- var nodeText = hits[i].childNodes[j].firstChild.nodeValue;
- show.hits[i][nodeName] = nodeText;
+ if (hits[i].childNodes[j].nodeName == 'location') {
+ var locNode = hits[i].childNodes[j];
+ var id = locNode.getAttribute('id');
+ show.hits[i]['location'][id] = {
+ "id": locNode.getAttribute("id"),
+ "name": locNode.getAttribute("name")
+ };
+ }
+ else {
+ var nodeName = hits[i].childNodes[j].nodeName;
+ var nodeText = hits[i].childNodes[j].firstChild.nodeValue;
+ show.hits[i][nodeName] = nodeText;
+ }