user12610369
user12610369

Reputation:

How to display BaseX get results in http website?

I have create a BaseX database and a mytest.xq file containing an XQuery for that database. When I write in my browser the following:

localhost:8984/rest?run=mytest.xq 

I get the desired results in an xml form. However I want to perform this using the html language to display those results in a website. Is this possible? If it is, can the results from xml be visualized better for example a table?

I have looked all the documentation regarding baseX http and have not found a way

Upvotes: 1

Views: 361

Answers (1)

Alex Everitt
Alex Everitt

Reputation: 23

You can add &method=html to your url like so:

localhost:8984/rest?run=mytest.xq&method=html

As long as you are returning html from your query then it will render with the method argument. You don't need RESTXQ for your simple needs.

The main BaseX page has an example file in the webapp folder called restxq.xqm where you can see how the basic home page is set up. You don't need RESTXQ but you can use the header information from that file in your test query and render your page with that in mind.

Also there is an entire app in the webapp/dba folder that is written entirely in RESTXQ.

Upvotes: 1

Related Questions