code: private void parseNames(Document doc, String expression) throws XPathExpressionException, IOException, SAXException {
          // parse input document
          XPath xPath = XPathFactory.newInstance().newXPath();
          NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(doc, XPathConstants.NODESET);
  
          for (int i = 0; i < nodeList.getLength(); i++) {
              if (nodeList.item(i).getAttributes().getNamedItem("name") != null) {
                  String nodeValue = nodeList.item(i).getAttributes().getNamedItem("name").getNodeValue();
  
                  // add unique values only
                  if (!nodeValue.isEmpty()) {
                      String resolved = getResolvedVariable(nodeValue);
                      if (!names.contains(resolved)) {
                          names.add(resolved);
                      }
                  }
              }
              else {
                  String nodeValue = nodeList.item(i).getAttributes().getNamedItem("location").getNodeValue();
  
                  // add unique values only
                  if (!nodeValue.isEmpty()) {
                      String resolved = getResolvedVariable(nodeValue);
                      if (!namelessLocations.contains(resolved)) {
                          namelessLocations.add(resolved);
                      }
                  }
              }
          }
      }
docs: Checks for application names in the document. Will add locations without names to a Set