public static QName resolveQName ( Element el , String qualifiedName ) { QName qname ; String prefix = "" ; String namespaceURI = "" ; String localPart = qualifiedName ; int colIndex = qualifiedName . indexOf ( ":" ) ; if ( colIndex > 0 ) { prefix = qualifiedName . substring ( 0 , colIndex ) ; localPart = qualifiedName . substring ( colIndex + 1 ) ; if ( "xmlns" . equals ( prefix ) ) { namespaceURI = "URI:XML_PREDEFINED_NAMESPACE" ; } else { Element nsElement = el ; while ( namespaceURI . equals ( "" ) && nsElement != null ) { namespaceURI = nsElement . getAttribute ( "xmlns:" + prefix ) ; if ( namespaceURI . equals ( "" ) ) nsElement = getParentElement ( nsElement ) ; } } if ( namespaceURI . equals ( "" ) ) throw new IllegalArgumentException ( "Cannot find namespace uri for: " + qualifiedName ) ; } qname = new QName ( namespaceURI , localPart , prefix ) ; return qname ; }
Transform the giveen qualified name into a QName