I'd like to call an XQuery function that I have written from XForms. I know how to execute a request to an XQuery document:
<xf:submission resource="/exist/rest/apps/Main/modules/import.xql"/>
But what if I'd like to call a specific function in the XQuery document? It looks like this can be done with JavaScript with import module namespace but is there not a way to do this in XForms?
I suppose I can use exist-db's controller.xql to handle requests. Is this the simplest way to do it?
You can't! XForms is not XQuery and there is nothing in the XForms specification that let's you import an XQuery module.
As others have previously suggested you need to use HTTP to bridge the two, and if you want direct access over HTTP to an XQuery function, then RESTXQ is your best bet.
Related
The first question I get from most of the developers I get is, Is there any way to auto generate your groovy file by by using swagger or may be plain json file?
Is there any way to do it?
I don't understand the question. What do you want to achieve? Do you NOT want to use Groovy file to define a contract? If that's the case then the answer is - you can use the Pact file (a json) to define the contract or you can plugin whatever you want. It's all written in the documentation - http://cloud.spring.io/spring-cloud-static/Dalston.SR4/multi/multi__pluggable_architecture.html.
As for Swagger we don't support it mainly because it's a schema. The reasons behind this decision are in this issue - https://github.com/spring-cloud/spring-cloud-contract/issues/136
I'm using a generator based on io.swagger's swagger-core + swagger-jaxrs library v1.5.13 and I wonder if there's an option to avoid allOf syntax. The other tool we use doesn't support the allOf syntax and we can't use it.
I don't like bending our java model just because of one problematic technology, is there and option how to tell the library not to generate allOf and flatten the view on a hirarchy of objects instead?
I already have a custom ModelResolver, but I hope for a more elegant solution than transforming the syntax with my code.
I used the following - https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/hybridwebview/ to implement a hybrid webview. All works fine expect the part where I need to call the C# function from Javascript. The C# handler gets called but from the article, it seems like I can only get a single parameter passed to C#. So message.Body.ToString() gives me the arguments passed from Javascript. I however want to pass atleast to arguments. Can anybody please show me how I can achieve this.
It looks like you can only pass one parameter through. Hence you just need to develop your own way to pass more information through. You could for example create a class and serialize it in JSON, then deserialize it at the other end. JSON serializers and deserializers are widely available in .NET and JS, this shouldn't be much of a problem at all.
Or if the data is really simple, e.g. 2 numbers, you could do 1#4, and split via the hash at the other end.
I have got a quick question regarding XQuery update, Dose XQJ support implementing XQuery update facility to insert an element into an XML document?
This depends on the XQuery Processor and XQJ implementation you are working with. As an example, BaseX and Charles Foster's implementation of XQJ is one combination that in fact supports the XQuery Update Facility.
Zorba also supports XQJ and XQuery update. You can find out more at http://www.zorba-xquery.com/html/entry/2012/07/27/XQJ_From_Zorba
I try to set up a web based application using spring and xslt. Since i always use xslt in a pipelining style, i would like to use calabash. Is there a possibility to call calabash from Java? I read thru the documentation on http://xmlcalabash.com but there is only a description how to use it from command line. I also tired to find some javadoc on githup but wasn't successful. Obviously, there is the Main class with the main() method and i could supply the command line parameters as a string array...
I wonder if there is a better way to do it.
I looked into this recently too. I took a pragmatic approach where I call Main.run(), and pass in a string array that I generate from a (File)Properties object. It doesn't allow passing in file inputs as streams or sources however, they must reside on the file-system.
Likely there are nicer ways. You could for instance look into http://expath.org/ . There should be sources of that project. The webapp modules (formerly known as servlex?) seems to provide XMLCalabash integration.
HTH!