Abstract
XQuery is widely known as a query language for XML, but it’s also a full-fledged, functional programming language which, with a limited number of implementation-provided extensions, can serve in a web development context as both the query language and the programming language. When you have data in XML form that needs to be delivered in some way on the web, using XQuery as the server-side programming language has significant practical advantages. After briefly describing those advantages, this paper will lay out techniques for developing web applications in XQuery—techniques that will reduce complexity and help developers produce well-organized, testable, portable code that will be comparatively easy to build upon and maintain over time. Topics include using MVC, keeping functions testable, and facilitating code portability by using available standardizations like RESTXQ and by isolating implementation-specific functions into separate modules.
Highlights
1.1 BackgroundXML Query Language (XQuery) was originally born from several competing query languages for XML[1]
For example to retrieve speeches given in Hamlet - http://localhost:8080/exist/rest/db/classics/shakespeare/hamlet.xml? _query=//speech or for example, to retrieve speeches given in any Shakespeare script - http://localhost:8080/exist/rest/db/classics/shakespeare/?_query=//speech b) For more complex XQuerys, the XQuery may be wrapped in a CDATA section of a simple XML document and sent to the server Uniform Resource Identifier (URI) by Hyper-Text Transfer Protocol (HTTP) POST
A Resource Function is an XQuery function which has been marked up with RESTful web service annotations. These annotations indicate to a processor that when presented with a RESTful web service request, that matches the constraints indicated by the annotations, the function should be invoked and the result returned as the result of the service request
Summary
XML Query Language (XQuery) was originally born from several competing query languages for XML[1] All of these languages had in common the noble yet limited goal of querying XML. They focused on XML as a read-only store for data. Triggered by XQuery users developing increasingly complex applications in XQuery, and the understanding that XQuery could produce XHTML, an XQuery processor operating on an XML Database was for the first time in 2003 coupled with a Web Server and REST interface in the eXist Native XML Database project[4] [5]. With the advent of being able to use XQuery as a server-side processing language, developers were soon building complete data driven Web Applications entirely in XQuery. The W3C XQuery Working Group has itself recognised the value in XQuery as a general purpose processing language through a new extension standard which enhances XQuery for this purpose: XQuery Scripting Extensions[11]
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.