public static QName readQName ( XMLStreamReader reader ) throws XMLStreamException { String value = reader . getElementText ( ) ; if ( value == null ) { return null ; } value = value . trim ( ) ; int index = value . indexOf ( ":" ) ; if ( index == - 1 ) { return new QName ( value ) ; } String prefix = value . substring ( 0 , index ) ; String localName = value . substring ( index + 1 ) ; String ns = reader . getNamespaceURI ( prefix ) ; if ( ( ! StringUtils . isEmpty ( prefix ) && ns == null ) || localName == null ) { throw new RuntimeException ( "Invalid QName in mapping: " + value ) ; } if ( ns == null ) { return new QName ( localName ) ; } return new QName ( ns , localName , prefix ) ; }
Reads a QName from the element text . Reader must be positioned at the start tag .