Monday 7 June 2010

Upload an XML File using the Web Client

The eXist-db Database Administration Web Client (web client for short) is a simple browser-based interface which allows you to - amongst other things - upload an XML document to an eXist-db database.

This tutorial demonstrates how to upload an XML document to an eXist-db database using the web client.

Start the Web Client
To start the eXist-db web client, either click this link, or open a web browser and navigate to:
http://localhost:8080/exist/admin/admin.xql
You will be presented with the Web Client login page:


Type in your admin password if you created one, then click Submit. You will then be presented with the Web Client database admin home page which looks something like this:


Create a Collection
Within eXist-db, XML documents are stored inside collections. So before you upload a documente, you should first create a collection in which to store it:
  1. From the menu on the left of the page, click "Browse collections".
  2. In the "New collection" textbox, type "test" (without the quotes).
  3. Click the "Create Collection" button.
You will see that a new collection "test" has been created:


Create an XML Document
Now create a small XML document. Use a plain text editor (e.g. Notepad) to create a text file containing only this text:
<hello>world</hello>
Save the file to your desktop and give it a filename of hi.xml:


Store the XML Document in the eXist-db Database
Back in the web client page, click the "test" collection you created earlier. You will see the contents of the "test" collection, which will be empty:


Click the "Choose File" button. A "file open" dialog box will appear. Select the "hi.xml" file you created then click the "Open" button.

Click the "Upload" button to upload hi.xml into the "test" collection of the eXist-db database:


Verify that the XML Data has been UpLoaded
To check that the XML file has been stored in the eXist-db database, you can view it directly using the web client. Click on the "hi.xml" link to view the XML output:


To view the XML source data, choose "View source" in your browser:

No comments:

Post a Comment