Forum Discussion

MOTOROLA_Suppor_1's avatar
15 years ago

Help needed for XQuery error/syntax?

I am try using XQuery for following soap response validation: ADMINSTATUE=enabled, See XQueryExpression and Expect Result.

But I got error, Not sure that is going on. Are there more XQuery document and more XQuery examples? Help needed.

thanks
sheena

XQuery Match Assertion failed for path [declare namespace ns2='http://asp.motorola.com/nbs/config/v1-0'; { for $z in //ns2:getPotsChannelsResponse/attrContainerList/strAttribute if ( $z/name/text() == "ADMINSTATUS" ) return {data($z/value/text())} } ] : RuntimeException:java.lang.reflect.InvocationTargetException


<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header>
<ns2:nbsHeader xmlns:ns2="http://asp.motorola.com/nbs/config/v1-0" xmlns:ns3="http://asp.motorola.com/ws/v1-0">
<authToken>
<userId>admin</userId>
<sessionId>604720141</sessionId>
</authToken>
<activityName>getPotsChannels</activityName>
</ns2:nbsHeader>
</S:Header>
<S:Body>
<ns2:getPotsChannelsResponse xmlns:ns2="http://asp.motorola.com/nbs/config/v1-0" xmlns:ns3="http://asp.motorola.com/ws/v1-0">
<attrContainerList>
<strAttribute>
<name>SIGNALCODE</name>
<value>loopstart</value>
</strAttribute>
<strAttribute>
<name>TRANSPATH</name>
<value>afterRing</value>
</strAttribute>
<name>TIMESLOT</name>
<value>0</value>
</strAttribute>
<strAttribute>
<name>VGINDEX</name>
<value>1</value>
</strAttribute>
<strAttribute>
<name>ADMINSTATUS</name>
<value>enabled</value>
</strAttribute>
<strAttribute>
...........

XQuery Expression:
declare namespace ns2='http://asp.motorola.com/nbs/config/v1-0';
<Result>
{
for $z in //ns2:getPotsChannelsResponse/attrContainerList/strAttribute
if ( $z/name/text() == "ADMINSTATUS" )
return <value>{data($z/value/text())}</value>
}
</Result>

Expect Result
<Result>
<value>enabled</value>
<Result>
  • I got the correct XQeury syntax to make it work. I am all set. thanks

    sheena


    declare namespace ns2='http://asp.motorola.com/nbs/config/v1-0';
    <Result>
    {
    for $z in //ns2:getPotsChannelsResponse/attrContainerList/strAttribute


    where $z/name = "ADMINSTATUS" or $z/name = "SIGNALCODE"
    order by $z/name
    return <value>{$z/value/text()}</value>
    }
    </Result>