code: public static QPath parse(String qPath) throws IllegalPathException
     {
        if (qPath == null)
           throw new IllegalPathException("Bad internal path '" + qPath + "'");
  
        if (qPath.length() < 2 || !qPath.startsWith("[]"))
           throw new IllegalPathException("Bad internal path '" + qPath + "'");
  
        int uriStart = 0;
        List<QPathEntry> entries = new ArrayList<QPathEntry>();
        while (uriStart >= 0)
        {
  
           uriStart = qPath.indexOf("[", uriStart);
  
           int uriFinish = qPath.indexOf("]", uriStart);
           String uri = qPath.substring(uriStart + 1, uriFinish);
  
           int tmp = qPath.indexOf("[", uriFinish); // next token
           if (tmp == -1)
           {
              tmp = qPath.length();
              uriStart = -1;
           }
           else
              uriStart = tmp;
  
           String localName = qPath.substring(uriFinish + 1, tmp);
           int index = 0;
           int ind = localName.indexOf(PREFIX_DELIMITER);
           if (ind != -1)
           { // has index
              index = Integer.parseInt(localName.substring(ind + 1));
              localName = localName.substring(0, ind);
           }
           else
           {
              if (uriStart > -1)
                 throw new IllegalPathException("Bad internal path '" + qPath
                    + "' each intermediate name should have index");
           }
  
           entries.add(new QPathEntry(uri, localName, index));
        }
        return new QPath(entries.toArray(new QPathEntry[entries.size()]));
     }
docs: Parses string and make internal path from it.
  
  @param qPath
  - String to be parsed
  @return QPath
  @throws IllegalPathException
  - if string is invalid