innov8cs
07-16-2007, 12:46 PM
I can't seem to get an xpathQuery working inside of an ondata handler inside of a <datapointer>. I know it's most likely my syntax of the xpathQuery but any help would be appreciated.
I've got a dataset that successfully gets a full set of XML that looks as follows:
<Envelope>
<Body>
<loginResponse>
<outMsgtxt/>
<outSuccess>true</outSuccess>
<outCompanyNo>9</outCompanyNo>
<outCompanyName>ANGELA TEST COMPANY</outCompanyName>
</loginResponse>
</Body>
</Envelope>
I've then set up a datapointer so it has an ondata handler so I can perform some data specific functions on it. I'm using a datapointer because I've got two different scenarios of how the same dataset's data is supposed to work. But inside the ondata I can't seem to get the outSuccess, outCompanyNo, etc. values I want. Here's the specific code, simplified a bit:
<canvas>
<dataset name="loginDataset" type="http" src="http://www.mydomain.com" request="false" />
<datapointer name="loginSuccess" rerunxpath="true" datapath="loginDataset:/Envelope/Body/loginResponse">
<handler name="ondata">
<![CDATA[
if (this.xpathQuery('outSuccess/text()') == 'true')
{
One thing goes here
}
else
{
Anotherthing goes here
}
]]>
</handler>
</datapointer>
I've tried any number of things with the datapath like:
loginDataset:/Envelope/Body/loginResponse
loginDataset:/Envelope/Body/loginResponse/
loginDataset:/Envelope/Body/loginResponse/*
loginDataset:/Envelope/Body/*
Then combined it with:
this.xpathQuery('/outSuccess/text()')
this.xpathQuery('loginResponse/outSuccess/text()')
this.xpathQuery('/loginResponse/outSuccess/text()')
this.xpathQuery('outSuccess')
No matter what I seem to do, the value that this.xpathQuery() returns is always null.
Anyone see where I went wrong??
Thanks.
I've got a dataset that successfully gets a full set of XML that looks as follows:
<Envelope>
<Body>
<loginResponse>
<outMsgtxt/>
<outSuccess>true</outSuccess>
<outCompanyNo>9</outCompanyNo>
<outCompanyName>ANGELA TEST COMPANY</outCompanyName>
</loginResponse>
</Body>
</Envelope>
I've then set up a datapointer so it has an ondata handler so I can perform some data specific functions on it. I'm using a datapointer because I've got two different scenarios of how the same dataset's data is supposed to work. But inside the ondata I can't seem to get the outSuccess, outCompanyNo, etc. values I want. Here's the specific code, simplified a bit:
<canvas>
<dataset name="loginDataset" type="http" src="http://www.mydomain.com" request="false" />
<datapointer name="loginSuccess" rerunxpath="true" datapath="loginDataset:/Envelope/Body/loginResponse">
<handler name="ondata">
<![CDATA[
if (this.xpathQuery('outSuccess/text()') == 'true')
{
One thing goes here
}
else
{
Anotherthing goes here
}
]]>
</handler>
</datapointer>
I've tried any number of things with the datapath like:
loginDataset:/Envelope/Body/loginResponse
loginDataset:/Envelope/Body/loginResponse/
loginDataset:/Envelope/Body/loginResponse/*
loginDataset:/Envelope/Body/*
Then combined it with:
this.xpathQuery('/outSuccess/text()')
this.xpathQuery('loginResponse/outSuccess/text()')
this.xpathQuery('/loginResponse/outSuccess/text()')
this.xpathQuery('outSuccess')
No matter what I seem to do, the value that this.xpathQuery() returns is always null.
Anyone see where I went wrong??
Thanks.