Hi I have a problem with XPath and XMLUnit.
I have two versions of an xml file one with namespace declarations and one without. Basically what I am trying to do is check if an element exists in the xml file using and Xpath expression and XMLUnit
test methods.
When I use the second version of the file the test passes ok. But when I use the first version of the file the test fails.
I am calling the test method as follows: The parameters are an Xpath expression and a document. If the element exists the method does nothing, if it fails and Assertion Error is thrown.
//Fails
XMLAssert.assertXpathExists("/Book/Title", xml1);
//Suceeds
XMLAssert.assertXpathExists("/Book/Title", xml2);
XML File 1
XML File 2
Any ideas?
Thanks, Mark.