code: public XmlParser.Node select(XmlParser.Node rootNode) {
          // check that the first char is /
          if (normalizedXPath.charAt(0) != '/') {
              throw new IllegalArgumentException("First part of xpath must be /");
          }
          
          // check that the path length is > 2
          if (normalizedXPath.length() <= 1) {
              throw new IllegalArgumentException("Xpath length must be > 1");
          }
  
          // we'll always start at the root
          XmlParser.Node node = rootNode;
  
          // navigate thru each part of the "path"
          int startPos = 1;
          boolean selectedRootNode = false;
          do {
              // find the next occurrence of the / char
              int nextPos = normalizedXPath.indexOf('/', startPos+1);
  
              // if not found then this is the last tag
              if (nextPos < 0) {
                  // set the nextPos to the end of this string
                  nextPos = normalizedXPath.length();
              }
  
              String tag = normalizedXPath.substring(startPos, nextPos);
  
              logger.debug("tag: " + tag);
  
              // unique case: we may currently be at the root node, in which
              // case we want to skip it....
              if (!selectedRootNode) {
                  // the "tag" MUST equal the root node's tag
                  if (!node.getTag().equals(tag)) {
                      // xpath didn't select the root node correctly
                      return null;
                  } else {
                      // xpath selected root node correctly, we basically will
                      // skip incrementing the node
                      selectedRootNode = true;
                  }
              } else {
                  // try to find this tag
                  node = node.getChild(tag);
                  if (node == null) {
                      // return null since this path doesn't exist
                      return null;
                  }
              }
  
              // increment startPos
              startPos = nextPos+1;
          } while (startPos < normalizedXPath.length());
  
          // if we get here, then return the node
          return node;
      }
docs: Selects the first node starting from the rootNode that matches this xpath.
  Useful for selecting a subtree.  For example, if the xpath is "/nodeA/nodeB",
  and that path exists starting from rootNode, then "nodeB" would be returned.
  @param rootNode The node to start from
  @return The selected node that matches the xpath