Hi, I have a simple query where I'm trying to use greater-than or less-than in a query. The documentation has multiple examples of this, such as:
<where>
<condition expr="(@age > 15 or @age <= 45) and (@city = 'Newton' or @city = 'Culver City') "/>
</where>
However, when I use a similar query, <condition expr="@id < 5000"/>
I get the response:
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring xsi:type="xsd:string">The XML SOAP message is invalid (service 'ExecuteQuery', method 'xtk:queryDef').</faultstring>
<detail xsi:type="xsd:string"><![CDATA[(16:38) : A '<' character cannot be used in attribute 'expr', except through <
...
So then I try as the error message suggests and use '<' instead of <
<condition expr="@id < 5000"/>
and I get a different error message:
<faultstring xsi:type="xsd:string">The XML SOAP message is invalid (service 'ExecuteQuery', method 'xtk:queryDef').</faultstring>
<detail xsi:type="xsd:string"><![CDATA[(16:40) : Unterminated entity reference, 'lt'
How can I specify '>' or '<' in my SOAP xml to get the API ExecuteQuery to work?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Blair,
Symbols '<' and '>' are restricted for use in XML. Hence they need to be used in escaped form.
Try using the following where clause and it should help.
<condition expr="@id > 25"/>
or
<condition expr="@id < 5000"/>
Regards,
Vipul
Views
Replies
Total Likes
here is my full soap contents:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:queryDef">
<soapenv:Header/>
<soapenv:Body>
<urn:ExecuteQuery>
<urn:sessiontoken>[deleted]</urn:sessiontoken>
<urn:entity>
<queryDef operation="select" schema="nms:recipient" lineCount="100" >
<select>
<node expr="@memberKey"/>
<node expr="@email"/>
<node expr="@blackListEmail"/>
<node expr="@blackList"/>
</select>
<where>
<condition expr="@email like '%@%' and (@blackList = 1 or @blackListEmail = 1)"/>
<condition expr="@id < 5000"/>
</where>
</queryDef>
</urn:entity>
</urn:ExecuteQuery>
</soapenv:Body>
</soapenv:Envelope>
Views
Replies
Total Likes
The mystery deepens:
I just tried this query, and it works with '>'!?:
<queryDef schema="nms:recipient" operation="select" lineCount="100">
<select>
<node expr="@email"/>
<node expr="@lastName"/>
<node expr="@firstName"/>
</select>
<where>
<condition expr="@id > 25"/>
</where>
</queryDef>
Views
Replies
Total Likes
Apparently, '<' does not work, but '>' does.
Therefore, a solution is to use NOT (... > ...) which will be equivalent to (... < ...)
Weird!
Views
Replies
Total Likes
Hi Blair,
Symbols '<' and '>' are restricted for use in XML. Hence they need to be used in escaped form.
Try using the following where clause and it should help.
<condition expr="@id > 25"/>
or
<condition expr="@id < 5000"/>
Regards,
Vipul
Views
Replies
Total Likes
Hi Blair,
Did you have a chance to try Vipul's answer as well? From what you mentioned in your initial question, I saw that the ";" character was missing from your condition ("<" instead of "<".
Let us know :-)
Florent.
Views
Replies
Total Likes
Yes, you found the issue - I didn't realize that I needed to add the semi-colon. Thanks for the help!
Views
Replies
Total Likes
Yes, you found the issue - I didn't realize that I needed to add the semi-colon. Thanks for the help!
Views
Replies
Total Likes