private static boolean isAttributeIgnored ( Node receivedElement , Node receivedAttribute , Set < String > ignoreMessageElements , NamespaceContext namespaceContext ) { if ( CollectionUtils . isEmpty ( ignoreMessageElements ) ) { return false ; } /** This is the faster version, but then the ignoreValue name must be * the full path name like: Numbers.NumberItem.AreaCode */ if ( ignoreMessageElements . contains ( XMLUtils . getNodesPathName ( receivedElement ) + "." + receivedAttribute . getNodeName ( ) ) ) { return true ; } /** This is the slower version, but here the ignoreValues can be * the short path name like only: AreaCode * * If there are more nodes with the same short name, * the first one will match, eg. if there are: * Numbers1.NumberItem.AreaCode * Numbers2.NumberItem.AreaCode * And ignoreValues contains just: AreaCode * the only first Node: Numbers1.NumberItem.AreaCode will be ignored. */ for ( String expression : ignoreMessageElements ) { Node foundAttributeNode = XMLUtils . findNodeByName ( receivedElement . getOwnerDocument ( ) , expression ) ; if ( foundAttributeNode != null && receivedAttribute . isSameNode ( foundAttributeNode ) ) { return true ; } } /** This is the XPath version using XPath expressions in * ignoreValues to identify nodes to be ignored */ for ( String expression : ignoreMessageElements ) { if ( XPathUtils . isXPathExpression ( expression ) ) { Node foundAttributeNode = XPathUtils . evaluateAsNode ( receivedElement . getOwnerDocument ( ) , expression , namespaceContext ) ; if ( foundAttributeNode != null && foundAttributeNode . isSameNode ( receivedAttribute ) ) { return true ; } } } return false ; }
Checks whether the current attribute is ignored .