Last active
May 20, 2016 12:15
-
-
Save apb2006/eed5a04c83511079eb6061f82b2ba60f to your computer and use it in GitHub Desktop.
call REx from XQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(: ebnf to Java parser for BaseX using REx :) | |
declare function local:REx-request($ebnf as xs:string,$name as xs:string,$command as xs:string)as item()+{ | |
let $req:= | |
<request xmlns="http://expath.org/ns/http-client" href='http://www.bottlecaps.de/rex/' method="post"> | |
<multipart media-type="multipart/form-data" boundary="xyzBouNDarYxyz"> | |
<header name="Content-Disposition" value='form-data; name="command"'/> | |
<body media-type="text/plain"/> | |
<header name="Content-Disposition" value='form-data; name="input"; filename="{$name}.ebnf"'/> | |
<body media-type="text/plain"/> | |
</multipart> | |
</request> | |
return http:send-request($req,(),($command,$ebnf)) | |
}; | |
let $ebnf:="S::=INT <?TOKENS?> INT::=[0-9]+" | |
let $command:="-java -basex -tree" | |
return local:REx-request($ebnf,"G",$command)[2] |
Author
apb2006
commented
May 19, 2016
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment