Forum Discussion
ThomasAu
15 years agoContributor
here is another example of code:
So, here, I want to assert to make sure that "ADAM" always has "New York".
If I try:
for true, then it will pass.
however, if I did the same thing but change "n2" to "Boston", it will still work. because there is a node n2 with "Boston".
ideally, i want to somehow say, look inside //H1/H2/e, and make sure all of this is in it. and put that whole entire chunk between the <e> in. And have "n4" be a wildcard.
<Response xmlns="http://iWantToIgnoreThis">
<H1>
<H2>
<e>
<n1>BOB</n1>
<n2>Boston</n2>
<n3>384-389-3812</n3>
<n4>xyz34</n4>
</e>
<e>
<n1>JOHN</n1>
<n2>Miami</n2>
<n3>204-942-2034</n3>
<n4>abadafeadsflasdf</n4>
</e>
<e>
<n1>ADAM</n1>
<n2>New York</n2>
<n3>123-392-2934</n3>
<n4>random</n4>
</e>
So, here, I want to assert to make sure that "ADAM" always has "New York".
If I try:
((//*[local-name()='H1']/*[local-name()='H2']/*[local-name()='e']/*[local-name()='n1'])="ADAM") and ((//*[local-name()='H1']/*[local-name()='H2']/*[local-name()='e']/*[local-name()='n2'])="New York")
for true, then it will pass.
however, if I did the same thing but change "n2" to "Boston", it will still work. because there is a node n2 with "Boston".
ideally, i want to somehow say, look inside //H1/H2/e, and make sure all of this is in it. and put that whole entire chunk between the <e> in. And have "n4" be a wildcard.