public static QName valueOf(String s){
  if ((s == null) || s.equals("")) {
    throw new IllegalArgumentException("invalid QName literal");
  }
  if (s.charAt(0) == '{') {
    int i=s.indexOf('}');
    if (i == -1) {
      throw new IllegalArgumentException("invalid QName literal");
    }
    if (i == s.length() - 1) {
      throw new IllegalArgumentException("invalid QName literal");
    }
 else {
      return new QName(s.substring(1,i),s.substring(i + 1));
    }
  }
 else {
    return new QName(s);
  }
}

public static QName valueOf ( String s ) { if ( ( s == null ) || s . equals ( "" ) ) { throw new IllegalArgumentException ( "invalid QName literal" ) ; } if ( s . charAt ( 0 ) == '{' ) { int i = s . indexOf ( '}' ) ; if ( i == - 1 ) { throw new IllegalArgumentException ( "invalid QName literal" ) ; } if ( i == s . length ( ) - 1 ) { throw new IllegalArgumentException ( "invalid QName literal" ) ; } else { return new QName ( s . substring ( 1 , i ) , s . substring ( i + 1 ) ) ; } } else { return new QName ( s ) ; } }
returns a qname holding the value of the specified string . < p > the string must be in the form returned by the qname . tostring ( ) method , i . e . " { namespaceuri } localpart " , with the " { namespaceuri } " part being optional . < p > this method doesn ' t do a full validation of the resulting qname . in particular , it doesn ' t check that the resulting namespace uri is a legal uri ( per rfc 2396 and rfc 2732 ) , nor that the resulting local part is a legal ncname per the xml namespaces specification .
