Database Reference
In-Depth Information
</classpath>
</taskdef>
All eXist's Ant tasks share the following attributes, so you might want to put the val‐
ues in Ant properties:
uri
This must be an XMLDB URI (see “XMLDB URIs” on page 92 ) that points to the
database and collection you want to work with. For example, to point to the
main /db collection for a default eXist installation:
xmldb:exist://localhost:8080/exist/xmlrpc/db
user and password
The credentials of the eXist user for accessing the database. You will most likely
want to use an account with admin privileges. If you don't specify these
attributes, the default guest account will be used.
failonerror
Whether or not an error should stop the build script (default: true ).
The first three attributes are the most important ones. For example, at the top of the
build.xml file in the accompanying book example code, you'll find properties defined
for them:
<property name= "BaseUri" value= "xmldb:exist://localhost:8080/exist/xmlrpc/db" />
<property name= "Username" value= "admin" />
<property name= "Password" value= "secret" />
Using Ant with eXist
The eXist Ant extension contains a large number of tasks to work with the database.
We're not going to list them all here as they are already well documented in the eXist
online documentation . Instead, we will leave you with a few tantalizing examples. All
examples given assume the preparations described in the previous section are in the
script also. These will not be repeated in every listing.
Basic example: Listing the main collections
The following basic (and probably un-useful) example serves as the “Hello World”
into the Ant extension—it lists the collections on the /db level:
<target name= "ListMainCollections" description= "Lists all collection in /db" >
<xdb:list uri= "${BaseUri}"
user= "${Username}" password= "${Password}" collections= "true"
outputproperty= "Collections" />
<echo> Main collections: ${Collections} </echo>
</target>
Search WWH ::




Custom Search