Hi Steve,
I have updated the Wikipedia OpenSearch example for the latest build:
http://www.agencexml.com/xsltforms/wikipediasearch.xml
I fixed the same bug but I think it is better to keep a short name for
the callback function so it is back from "XsltForms_browser.jsoninst" to
"jsoninst".
Comparing to the old version of this example, @mediatype="text/jsonp" is
now mandatory for the submission. The generated XML structure for the
JSON response is defining elements with different names so "*" is to be
used in XPath expressions instead of "item".
This is still an experimental feature because the XForms 2.0
Specifications are not yet fully detailed about serialization in XML and
mediatype.
Thank you for your feedbacks!
-Alain
Le 23/08/2012 03:09, Stephen Cameron a écrit :
> Hi Alain,
>
> There is a simple bug in revision 556 regarding JSONP support
>
> from line 3885
> if (this.mediatype === "text/jsonp") {
> XsltForms_browser.jsoninstobj = !instance ? (node ?
> document.getElementById(XsltForms_browser.getMeta(node.documentElement
> ? node.documentElement : node.ownerDocument.documentElement,
> "instance")).xfElement : this.model.getInstance()) :
> document.getElementById(instance).xfElement;
> var scriptelt = XsltForms_browser.isXhtml ?
> document.createElementNS("http://www.w3.org/1999/xhtml", "script") :
> document.createElement("script");
> << scriptelt.setAttribute("src", action.replace(/&/g,
> "&")+((action.indexOf("?") === -1) ? "?" : "&")+"callback=jsoninst");
> >> scriptelt.setAttribute("src", action.replace(/&/g,
> "&")+((action.indexOf("?") === -1) ? "?" :
> "&")+"callback=XsltForms_browser.jsoninst");
> scriptelt.setAttribute("id", "jsoninst");
> scriptelt.setAttribute("type", "text/javascript");
> body = XsltForms_browser.isXhtml ?
> document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml",
> "body")[0] : document.getElementsByTagName("body")[0];
> body.insertBefore(scriptelt, body.firstChild);
> XsltForms_xmlevents.dispatch(this, "xforms-submit-done");
> XsltForms_globals.closeAction();
> } else {
>
> The ALA web service does support JSONP once you know what it does its
> quite neat!
>
> Regards
> Steve
|