Chapter 5. Working with the Database
At its core, eXist is an XML database. It stores XML efficiently and makes fast querying possible. Besides XML, it is also capable of storing other file types. Although in its default configuration it doesn’t do much with them besides storing and retrieving, this capability is useful when you are building applications with eXist.
This chapter is about eXist’s database: what’s in it, how it’s structured, how you access and update its content, and (of course) how you query it.
The Database’s Content
In this section we will dive into the contents of the database.
Help: Where Is My XML?
Superficially, when you’re accessing the database using a WebDAV client, eXist’s database looks like a filesystem: you’ll see directories and files, and you can work with them directly as you would in any other filesystem.
Of course, under the surface things look very different. XML files are “ripped apart” (or “shredded”), indexed, and stored in a way that makes searching, indexing, and retrieval efficient. You can see this in action when you store a file in the database and reopen it: the indentation after reopening will probably look different. This is because the document was not stored as is, but rather as a tree structure according to the XML data model. The document was likely recreated using different indentation rules than those with which the original was created.
Related to this is one of the most frequently asked questions from eXist newcomers: “Where is my XML?” ...