Skip to main content
. 2015 Jun 16;15(6):14180–14206. doi: 10.3390/s150614180
Listing 1: Advertisement filter used by the bus stations
1 function evaluate(XMLdocument) {
2  importPackage(javax.xml.xpath);
3  var XPath = XPathFactory.newInstance().newXPath();
4 if((XPath.evaluate(“⫽observable[uri=‘/location’ and unit=‘WGS84’]”,
5    XMLdocument, XPathConstants.NODESET).length == 0) &&
6   (XPath.evaluate(“⫽observation[uri=‘/pollution/carbon-monoxide’ and unit=‘ppm’]”,
7    XMLdocument, XPathConstants.NODESET).length == 0)) {
8   return false;
9  }
10 if((XPath.evaluate(“⫽QoCIndicator[@id=‘10’ and
11    QoCCriterion[@id=‘[10.1]’]/QoCMetricDefinition[@id=‘10.1’]]”,
12    XMLdocument, XPathConstants.NODESET).length == 0) &&
13   (XPath.evaluate(“⫽QoCIndicator[@id=‘7’ and
14    QoCCriterion[@id=‘[7.1]’]/QoCMetricDefinition[@id=‘7.1’] and QoCMetricValue[@value<=‘50’]]”,
15    XMLdocument, XPathConstants.NODESET).length == 0) &&
16   (XPath.evaluate(“⫽QoCIndicator[@id=‘15’ and
17    QoCCriterion[@id=‘[15.1]’]/QoCMetricDefinition[@id=‘15.1’] and QoCMetricValue[@value<=‘30’]]”,
18    XMLdocument, XPathConstants.NODESET).length == 0)) {
19   return false;
20  }
21 return true;
22 }