Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Can we get where exactly the xpath has failed while verifying it against an XML

$
0
0

Hi,

I have some xpath(few examples below) and I am validating against xml response , while doing so can I get exactly where the xpath has failed 

xpath: 1.   //view/section/row[cell/data[@value='myjob']]/cell[8]/data[@value='Completed']

2. //view/section/row/cell[5]/action[@actionId='nmc.jobProperties' and @type='url']/label[@value='myjob']

3. //view/title[@value='Jobs: Scheduled Jobs']

4. complex an nested one

//view/section/row[(cell/data[@value='Other Roles']) and (cell/data[contains(@value,'336')]) and (cell/data[contains(@value,'0')]) and (cell/data[contains(@value,'320')]) and (cell/data[contains(@value,'16')]) and (cell/data[contains(@value,'0')]) and (cell/data[contains(@value,'0')]) and (cell/data[contains(@value,'0')]) and (cell/data[contains(@value,'0')]) and (cell/data[contains(@value,'0')]) and (cell/data[contains(@value,'0')]) and (cell/data[contains(@value,'0')]) and (cell/data[contains(@value,'0')]) and (cell/data[contains(@value,'0')])]

etc

so, while validating these xpaths against xml which i already have, I should be able to get where exactly the xpath failed 

say 1. failed at //view/section/row[cell        -- becoz row doesnot have a cell

2. failed at //view/section/row/cell[5]/action[@actionId='nmc.jobProperties' and @type='url'] becoz type has no value

3. failed at //view/title[@value='Jobs: Scheduled Jobs'] becoz value has just 'Scheduled Jobs' instead of 'Jobs: Scheduled Jobs'

4. failed at //view/section/row[(cell/data[@value='Other Roles']) and (cell/data[contains(@value,'336')]) and (cell/data[contains(@value,'0')]) and (cell/data[contains(@value,'320')])  becoz row didnot have cell with value 320

Any suggestions/help for optimized programming

Thanks in advance

Sam


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>