1

I'm trying to create a really basic web app that lets a user upload an xml file with a form, runs an XQuery script which I already have written as a function, and returns the result. I have BaseX running on Tomcat, but for the life of my I cannot understand RESTXQ even though I have a lot of experience with complex XQuery scripts. The BaseX documentation has been no help (http://docs.basex.org/wiki/RESTXQ). What is the basic architecture?

From what I can see, its all keyed on this restxq.xqm file in the webapp directory. If you link to that directory it runs the .xqm file and this is mandated by a web.xml file. But it seems that all of the html sections are also stored within this restxq.xqm file. Wouldn't it make sense so store html sections in separate files for maintenance/reusability?

Also, for my file upload form, do I have the action attribute point to restxq.xqm? I can make the pages all static html since the app is so simple, but where is the index.html file go? This seems WAY more confusing than it has to be.

user2509710
  • 79
  • 1
  • 7
  • 1
    You really seem confused ;) Unfortunately, your question is not a good fit for SO as it is too broad, it will be more appropriate at our ML at https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk. Here is a small blog example, maybe this helps you get a better grasp: https://github.com/siserle/blog-example – dirkk Aug 05 '14 at 07:51
  • To answer a few questions: Yes, it makes sense from an architectural point of view to store HTML separately (and we do this regularly in our projects), but as HTML is an XML dialect you don't have to do it. Basically, each xqm file in your restxq directory (i.e. it does not just apply to the restxq.xqm file) is parsed. You point your file upload form to the path you have given your function using the %rest:path annotation. You can set your tomcat in a way that static content will simply be delivered, i.e. serving index.html or pictures, css, ... to the client directly. – dirkk Aug 05 '14 at 07:55
  • @dirkk I didn't know that BaseX requires tomcat to function as an html server? Would you elaborate? – Nicholas Saunders Jun 20 '20 at 09:06

0 Answers0