
Site based on 1.3.0dev-rev:9127-20090613
Open Source Native XML Database
Examples
The examples below require some XML documents to be stored in the database. If you
have not yet imported these files, go to Examples
Setup.
XQueryServlet (just eXist, no Cocoon)
|
XQuery Sandbox
|
A web interface to execute XQueries on the server. Uses
AJAX technology to validate your XQuery while you type. Requires
Javascript to be enabled. Demonstrates more advanced techniques for
writing web applications with XQuery, XML/HTML, CSS and Javascript.
|
|
Guess a Number
|
Simple number guessing game to illustrate different
servlet features. |
|
XQuery Function Library Search
|
The search interface for XQuery functions demonstrates usage of
the NGram index or AJAX. The function documentation is generated once from
the Java classes and stored in XQDoc format. |
|
Search the Documentation
|
A not too complex example featuring full text queries and
post-processing of query results to show keywords in context.
|
|
Built-in functions
|
A simple example which lists all functions in the built-in XQuery function library.
It uses the transform function to transform XML output into HTML using an XSL
stylesheet (also check the function search
interface. |
|
Simple HTML Example
|
Prints a table in HTML with 10x10 cells. |
|
Fibonacci
|
Calculates the first 10 Fibonacci numbers. |
|
XML Acronyms
|
XQuery version of the XML Acronym
Demystifier, entirely implemented in XQuery. |
|
Session example
|
Presents a login page. Only valid database users can log
in. User and password are stored in the HTTP session. |
|
Basic form example
|
Presents a form page. The response echoes the name entered.
|
|
Form example with XUpdate
|
Presents a form page. The response echoes all the names
entered since database creation. |
|
Twitter client
|
A simple twitter client, which demonstrates
how to use the http client library to retrieve XML data
from external data sources. For a more complex twitter example,
see an
article
published on DevX. |
|
First-class functions example
|
Demonstrates the use of first-class functions. First-class
functions are supported through the eXist-specific extension functions:
util:function and util:call. |
|
W3C XQuery Test suite (XQTS)
|
Using this web application you can run the official XQuery test
suite on eXist. You will need to download the test suite data (read
the notice shown when you first access the page). The test runner is entirely written
in XQuery and is a good example for a complex script using lots of AJAX. |
|
Transform XML fragments to JSON
|
An XQuery does not necessarily need to return XML. |
|
URL Rewriting
|
eXist's XQueryURLRewrite servlet filter calls a user-defined XQuery to
decide how a HTTP request is handled. The XML fragment returned by the
query determines how the request is processed. This happens transparently
to the client. One or more "views" can be applied to a request to further processes it.
This is how most of the pages here are rendered (except the Cocoon examples). Have a look
the main controller XQuery, which resides in webapp/controller.xql. |
|
Bibliography 2
|
Another bibliographic demo from
previous releases of eXist. No AJAX. |
Misc Examples
|
XInclude Sample
Document
|
Dynamically generates a page out of the database by
expanding XInclude tags found in the source document. |
|
Retrieve a document
through REST
|
Retrieves a document through the REST-style API. The
document contains an XSL processing instruction. The XSL stylesheet is
read from the database and applied to the output. Please note that also
the CSS file referenced by the HTML output is loaded from the
database. |
Cocoon Examples
These are older examples based on different Cocoon features.
Some of the examples have been rewritten in XQuery, so there are now two
versions of these. Please note: the demonstrated features, in particular: XSP
and the XML:DB transformer, are still functional, but not actively
maintained!
|
Bibliography
|
A bibliographic demo, based on the MODS bibliographic
format, which is maintained by the Library of Congress. Shows session
handling and user authentication as well as some AJAX goodies. |
| Cocoon XML:DB Pseudo-Protocol |
|
Cocoon-based Database Browser
|
A database browser which uses Cocoon's xmldb://
pseudo-protocol and XSL stylesheets for the rendering. |
| eXist's XSP Logicsheet |
|
XML Acronyms
|
An XSP-based version of the XML Acronym
Demystifier
|
External Examples
|
AtomicWiki
|
AtomicWiki is a combined Wiki and Weblog entirely
written in XQuery (and some XSLT) and using XQuery as a scripting
language within Wiki entries and Blog posts.
|