public static void assertXpathNotExists ( String xPathExpression , Document inDocument ) throws XpathException { XpathEngine simpleXpathEngine = XMLUnit . newXpathEngine ( ) ; NodeList nodeList = simpleXpathEngine . getMatchingNodes ( xPathExpression , inDocument ) ; int matches = nodeList . getLength ( ) ; assertEquals ( "Should be zero matches for Xpath " + xPathExpression , 0 , matches ) ; }
Assert that a specific XPath does NOT exist in some given XML