Code example for QName

Methods: getLocalPartgetNamespaceURI

0
   * @param qname a {@link QName}. 
   * 
   * @return stringified representation 
   */ 
  public static String fromQName(QName qname) {
    return "{" + qname.getNamespaceURI() + "}" + qname.getLocalPart();
  } 
 
  /** 
   * Create a {@link QName} object from its stringified representation. 
   * 
   * @see #fromQName(javax.xml.namespace.QName) 
   * @param s stringified representation 
   * @return de-stringified {@link QName} 
   * @throws IllegalArgumentException if the given string is not a valid stringified {@link QName}. 
   */ 
  public static QName toQName(String s) {
    if (s.charAt(0) != '{') {
      throw new IllegalArgumentException("Malformed QNAME: " + s);
    }