code: private QPathEntry parsePatternQPathEntry(String namePattern, SessionImpl session) throws RepositoryException
     {
        int colonIndex = namePattern.indexOf(':');
        int bracketIndex = namePattern.lastIndexOf('[');
  
        String namespaceURI;
        String localName;
        int index = getDefaultIndex();
        if (bracketIndex != -1)
        {
           int rbracketIndex = namePattern.lastIndexOf(']');
           if (rbracketIndex < bracketIndex)
           {
              throw new RepositoryException("Malformed pattern expression " + namePattern);
           }
           index = Integer.parseInt(namePattern.substring(bracketIndex + 1, rbracketIndex));
        }
  
        if (colonIndex == -1)
        {
           namespaceURI = "";
           localName = (bracketIndex == -1) ? namePattern : namePattern.substring(0, bracketIndex);
        }
        else
        {
           String prefix = namePattern.substring(0, colonIndex);
           localName =
              (bracketIndex == -1) ? namePattern.substring(colonIndex + 1) : namePattern.substring(0, bracketIndex);
  
           if (prefix.indexOf("*") != -1)
           {
              namespaceURI = "*";
           }
           else
           {
              namespaceURI = session.getNamespaceURI(prefix);
           }
        }
  
        return new PatternQPathEntry(namespaceURI, localName, index);
     }
docs: Parse QPathEntry from string namePattern. NamePattern may contain wildcard symbols in
  namespace and local name. And may not contain index, which means look all samename siblings.
  So ordinary QPathEntry parser is not acceptable.
  
  @param namePattern string pattern
  @param session session used to fetch namespace URI
  @return PatternQPathEntry
  @throws RepositoryException if namePattern is malformed or there is some namespace problem.