Forum Discussion
Hi,
You could certainly do this with a Script Assertion, but in terms of XQuery is what you're looking for something like this:
1) You have something like:
<diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<NewDataSet xmlns="">
<Status diffgr:id="Status12" msdata:rowOrder="11">
<id>28</id>
<name>Review1</name>
<categoryId>3</categoryId>
<assignrule>P</assignrule>
<ismoveAssign>0</ismoveAssign>
<isActive>1</isActive>
</Status>
<Status diffgr:id="Status12" msdata:rowOrder="11">
<id>28</id>
<name>Review2</name>
<categoryId>3</categoryId>
<assignrule>P</assignrule>
<ismoveAssign>0</ismoveAssign>
<isActive>1</isActive>
</Status>
<Status diffgr:id="Status12" msdata:rowOrder="11">
<id>28</id>
<name>Review3</name>
<categoryId>3</categoryId>
<assignrule>P</assignrule>
<ismoveAssign>0</ismoveAssign>
<isActive>1</isActive>
</Status>
</NewDataSet>
</diffgr:diffgram>
2) You apply XQuery:
<Result>
{
for $x in //Status
return <name> string {data($x/name/text())} </name>
}
</Result>
3) And get:
<?xml version="1.0" encoding="UTF-8"?> <Result> <name> string Review1</name> <name> string Review2</name> <name> string Review3</name> </Result>
?
Let me know,
Cheers,
Rupert
- Sphujidhwaj10 years agoContributor
<diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <NewDataSet xmlns=""> <Status diffgr:id="Status1" msdata:rowOrder="11"> <id>28</id> <name>Review1</name> <categoryId>3</categoryId> <assignrule>P</assignrule> <ismoveAssign>0</ismoveAssign> <isActive>1</isActive> </Status> <Status diffgr:id="Status2" msdata:rowOrder="11"> <id>28</id> <name>Review2</name> <categoryId>3</categoryId> <assignrule>P</assignrule> <ismoveAssign>0</ismoveAssign> <isActive>1</isActive> </Status> <Status diffgr:id="Status3" msdata:rowOrder="11"> <id>28</id> <name>Review3</name> <categoryId>3</categoryId> <assignrule>P</assignrule> <ismoveAssign>0</ismoveAssign> <isActive>1</isActive> </Status> </NewDataSet> </diffgr:diffgram>The StatusID also keeps changing here..
- rupert_anderson10 years agoValued Contributor
OK, so it does, do you exepect to see the id in the output, thats not outlined in the original post? If so, please provide a sample of exactly what you expect in terms of the resulting XML and then I might be able to help.
- nmrao10 years agoCommunity HeroIs there any relation between the id and name? What is the issue if id gets changed?
- Sphujidhwaj10 years agoContributor
Yes there is relation between ID and Name with the varying input in the Request XML these IDs and Names change accordingly.
I get a response as shown in the previous post.
Please find the screenshot attached in the earlier post. I get statuses which are nearly 400-500 which I need to assert. Is XQuery Match Configuration assertion good to use ?