Skip to content

Instantly share code, notes, and snippets.

@jefferyto
Created October 7, 2012 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jefferyto/3848531 to your computer and use it in GitHub Desktop.
Save jefferyto/3848531 to your computer and use it in GitHub Desktop.
Open Data table to run a query and stringify its return value
<?xml version="1.0" encoding="UTF-8" ?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Jeffery To</author>
<description>Open Data table to run a query and stringify its return value</description>
<sampleQuery>select * from {table} where query='select * from html where url="http://www.yahoo.com/"' and xpath='//a'</sampleQuery>
</meta>
<bindings>
<select itemPath="" produces="XML">
<urls>
<url></url>
</urls>
<inputs>
<key id="query" type="xs:string" paramType="variable" required="true" />
<key id="xpath" type="xs:string" paramType="variable" required="false" />
</inputs>
<execute><![CDATA[
var q = y.query(query), results = q.results;
if (xpath) {
results = y.xpath(results, xpath);
}
response.object = results.toXMLString();
]]></execute>
</select>
</bindings>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment