NAVTEQ_Support_1
15 years agoContributor
XPath comparison of response to request confused by comments
XPath comparison of response to request gets confused by comments in request.
Here is a piece of request:
<dom:CustomAttribute>
<!--You may enter the following 2 items in any order-->
<dom:key>TestKey</dom:key>
<dom:value>TestValue</dom:value>
</dom:CustomAttribute>
and the corresponding response:
<dom30:CustomAttribute>
<dom30:key>TestKey</dom30:key>
<dom30:value>TestValue</dom30:value>
</dom30:CustomAttribute>
XPath for their comparison:
Xpath from response:
declare namespace am30='http://www.navteq.com/schemas/ncs/fbs/applicationmanagement-3.0/';
declare namespace dom30='http://www.navteq.com/schemas/ncs/fbs/domain-3.0/';
//am30:AddCustomAttributeToUserApplicationOutput[1]/dom30:UserApplication[1]/dom30:CustomAttribute[1]
Xpath from request:
${AddCustomAttributeToUserApplication#Request#declare namespace app='http://www.navteq.com/schemas/ncs/fbs/applicationmanagement-3.0/'; declare namespace dom='http://www.navteq.com/schemas/ncs/fbs/domain-3.0/'; //app:AddCustomAttributeToUserApplicationInput[1]/dom:CustomAttribute[1]}
Ignore namespaces is checked in the XPath dialog setup window.
Error message is returned when XPath is evaluated:
XPathContains assertion failed for path [declare namespace am30='http://www.navteq.com/schemas/ncs/fbs/applicationmanagement-3.0/'; declare namespace dom30='http://www.navteq.com/schemas/ncs/fbs/domain-3.0/'; //am30:AddCustomAttributeToUserApplicationOutput[1]/dom30:UserApplication[1]/dom30:CustomAttribute[1]] : Exception:org.custommonkey.xmlunit.Diff [different] Expected number of child nodes '7' but was '5' - comparing at /CustomAttribute[1] to at /CustomAttribute[1]
As soon as the comment from request is deleted (<!--You may enter the following 2 items in any order-->), XPath works and match is confirmed.
Here is a piece of request:
<dom:CustomAttribute>
<!--You may enter the following 2 items in any order-->
<dom:key>TestKey</dom:key>
<dom:value>TestValue</dom:value>
</dom:CustomAttribute>
and the corresponding response:
<dom30:CustomAttribute>
<dom30:key>TestKey</dom30:key>
<dom30:value>TestValue</dom30:value>
</dom30:CustomAttribute>
XPath for their comparison:
Xpath from response:
declare namespace am30='http://www.navteq.com/schemas/ncs/fbs/applicationmanagement-3.0/';
declare namespace dom30='http://www.navteq.com/schemas/ncs/fbs/domain-3.0/';
//am30:AddCustomAttributeToUserApplicationOutput[1]/dom30:UserApplication[1]/dom30:CustomAttribute[1]
Xpath from request:
${AddCustomAttributeToUserApplication#Request#declare namespace app='http://www.navteq.com/schemas/ncs/fbs/applicationmanagement-3.0/'; declare namespace dom='http://www.navteq.com/schemas/ncs/fbs/domain-3.0/'; //app:AddCustomAttributeToUserApplicationInput[1]/dom:CustomAttribute[1]}
Ignore namespaces is checked in the XPath dialog setup window.
Error message is returned when XPath is evaluated:
XPathContains assertion failed for path [declare namespace am30='http://www.navteq.com/schemas/ncs/fbs/applicationmanagement-3.0/'; declare namespace dom30='http://www.navteq.com/schemas/ncs/fbs/domain-3.0/'; //am30:AddCustomAttributeToUserApplicationOutput[1]/dom30:UserApplication[1]/dom30:CustomAttribute[1]] : Exception:org.custommonkey.xmlunit.Diff [different] Expected number of child nodes '7' but was '5' - comparing at /CustomAttribute[1] to at /CustomAttribute[1]
As soon as the comment from request is deleted (<!--You may enter the following 2 items in any order-->), XPath works and match is confirmed.