public static boolean nodeMatches ( final Node nd , final QName tag ) { if ( tag == null ) { return false ; } String ns = nd . getNamespaceURI ( ) ; if ( ns == null ) { /* It appears a node can have a NULL namespace but a QName has a zero length */ if ( ( tag . getNamespaceURI ( ) != null ) && ( ! "" . equals ( tag . getNamespaceURI ( ) ) ) ) { return false ; } } else if ( ! ns . equals ( tag . getNamespaceURI ( ) ) ) { return false ; } String ln = nd . getLocalName ( ) ; if ( ln == null ) { if ( tag . getLocalPart ( ) != null ) { return false ; } } else if ( ! ln . equals ( tag . getLocalPart ( ) ) ) { return false ; } return true ; }
See if node matches tag