private static String fixupXPath(String xpath){
  final int end=xpath.length();
  int offset=0;
  boolean whitespace=true;
  char c;
  for (; offset < end; ++offset) {
    c=xpath.charAt(offset);
    if (whitespace) {
      if (!XMLChar.isSpace(c)) {
        if (c == '.' || c == '/') {
          whitespace=false;
        }
 else         if (c != '|') {
          return fixupXPath2(xpath,offset,end);
        }
      }
    }
 else     if (c == '|') {
      whitespace=true;
    }
  }
  return xpath;
}

private static String fixupXPath ( String xpath ) { final int end = xpath . length ( ) ; int offset = 0 ; boolean whitespace = true ; char c ; for ( ; offset < end ; ++ offset ) { c = xpath . charAt ( offset ) ; if ( whitespace ) { if ( ! XMLChar . isSpace ( c ) ) { if ( c == '.' || c == '/' ) { whitespace = false ; } else if ( c != '|' ) { return fixupXPath2 ( xpath , offset , end ) ; } } } else if ( c == '|' ) { whitespace = true ; } } return xpath ; }
fixup xpath expression . avoid creating a new string if possible .
