YOUR FEEDBACK
Werner Keil wrote: Java 6 update 10. If I'd be running Apple, I'd probably really drop dead...
AJAXWorld RIA Conference
$300 Savings Expire September 5th. Register Today and SAVE!


2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TODAY'S TOP SOA & WEBSERVICES LINKS


XML Product Review: "Getting to Know Xindice"
An open source native XML database

Apache Software Foundation's Xindice is an open source native XML database. Apache provides great software to developers such as the Apache Web Server, Tomcat Application Server, Cocoon Web Development Framework, Struts Framework, Ant, and many more under an open source license. Apache Web Server is an industrial-strength product that is used by many high-traffic Web sites. Apache Tomcat is a servlet container that implements both Java Servlets and Java Server Pages. The fact that Xindice is a member of the Apache Software Foundation gives it substantial credibility, because Apache produces well-known, well-respected software. We will explore the Xindice native XML database beginning with its installation and advancing step by step. As the Xindice home page suggests, you are encouraged to pronounce it as "zeen-dee-chay" with your best faux Italian accent. Xindice supports XPath query language, XML:DB, and XUpdate standards in Java, in addition to XML-RPC API for non-Java programmers.

Installation
You can download both the source files and the binaries from the home page of Xindice at http://xml.apache.org/xindice/. As I write, the latest stable release is 1.0, and the current milestone is 1.1b4. I downloaded the binary files in both webapp and .jar formats. You don't need to download the source files if you aren't interested in reading or modifying them.

Version 1.1 of Xindice doesn't run as a stand-alone server, but instead runs under a servlet 2.2-compliant application server. The documentation states that it's tested both with Tomcat and Jetty. Since Tomcat is very popular and I am familiar with it, I decided to run Xindice with Tomcat. You can download Tomcat from http://tomcat.apache.org. I downloaded the Windows executable, binary core distribution version 5.0.28.

Because I already have a Java SDK (Software Development Kit) installed on my machine, I didn't need to download it again, but if you don't have a Java SDK, you have to download version 1.4.x of J2SE (Java 2 Standard Edition) from http://java.sun.com.

I installed Xindice and Tomcat and tested all of the examples in this article on my laptop, a 1.4GHz Pentium M processor, running on Windows XP Professional with 512MB main memory, without any problems. These are the installations steps I followed:

  1. Install Java 1.4.x SDK.
  2. Set JAVA_HOME environment variable to the installation directory (on my system the value of JAVA_HOME is D:\j2sdk1.4.2_03).
  3. Install Tomcat. (This step is straightforward because Tomcat comes with an installer. By default Tomcat will install under C:\Program Files, with a space between the words Program and Files: unfortunately there will be some problems when running Xindice, so I changed the installation location to D:\Tomcat_5.0. Any location will do as long as it doesn't have any space in it.)
  4. Unzip the Xindice webapp distribution, and rename the .war file (xindice-1.1b4.war) to xindice.war.
  5. Drop xindice.war (the extension war stands for web archive) under Tomcat's webapps directory (this is D:\Tomcat_5.0\webapps on my system).
  6. Start Tomcat using the "Configure Tomcat" application (it's located under Start->All Programs->Apache Tomcat 5.0->Configure Tomcat).
  7. In a few minutes Tomcat will unzip the .war file. When it does, you should see a new Xindice directory under D:\Tomcat_5.0\webapps.
  8. Now it's time to create a new environment variable called XINDICE_HOME. If you followed the locations I suggested, XINDICE_HOME should have D:\Tomcat_5.0\webapps\xindice\WEB-INF as its value. If you didn't, modify the value accordingly.
  9. As the last step, put D:\Tomcat_5.0\webapps\xindice\WEB-INF under your Path since it contains the Xindice's command-line tool.
Starting the Server
Starting or stopping the Xindice native XML database means starting or stopping the Tomcat Server. Tomcat by default runs on port 8080, and you can change the port during or after the installation. To check if your Tomcat is running properly, after starting it visit http://localhost:8080/ (or http://127.0.0.1:8080/ ): you should see the welcome page.

Command-Line Tool
We can perform the following tasks using the command-line tool:

  • Add/remove a collection
  • List collections
  • Add/remove a document
  • Retrieve documents
  • Import/export a directory tree
  • Add/remove a collection index
  • Execute an XPath query
Listing Collections
Let's list the collections installed by Xindice after the installation. Remember that the server should be running in order to execute this command successfully:

> xindice list_collections -c xmldb:xindice://localhost:8080/db

trying to register database
       system
       meta
Total collections: 2

Each command has an abbreviated version. For example, we could have used lc instead of list_collections. For clarity, in this article I will use the full name of the commands. After familiarizing yourself with Xindice, you probably won't want to write the commands in full. You can find the abbreviated versions and the descriptions of all the commands at the Xindice Commandline Tool Guide.

In this example, the full context is xmldb:xindice://localhost:8080/db, which is specified by the -c option. When using Tomcat we have to specify the full context: Tomcat runs on port 8080, but Xindice is preconfigured for Jetty, which runs on port 8888. If you don't want to specify the full context, you have two options: change the Tomcat's port to 8888 or install Jetty instead of Tomcat. If the server is running on a different machine and not on the localhost, you should replace the localhost portion of the context with the correct URL.

After executing this command the system responded by telling us that there are two collections: systems and meta. Like the other popular open source native XML databases such as eXist and Berkeley DB XML, Xindice too uses the idea of collection. A collection is similar to a folder in terms of functionality. You can have several XML files under a collection, which is a neat way of organizing the documents.

Adding a Collection
Let's create a new collection called dictionary:

> xindice add_collection -c xmldb:xindice://localhost:8080/db -n dictionary

trying to register database
Created : xmldb:xindice://localhost:8080/db/dictionary

As in the previous example, -c specifies the context that is the root location (all of the data files and collections are stored under this location). By executing this command successfully we created a subcollection called dictionary. The context of this new location is xmldb:xindice://localhost:8080/db/dictionary.

Listing the collections reveals that now we have three collections, of which two of them were previously created.

> xindice list_collections -c xmldb:xindice://localhost:8080/db

trying to register database
       dictionary
       system
       meta
Total collections: 3

About Selim Mimaroglu
Selim Mimaroglu is a PhD candidate in computer science at the University of Massachusetts in Boston. He holds an MS in computer science from that school and has a BS in electrical engineering.

XML JOURNAL LATEST STORIES . . .
To be able to do anything useful, an ESB must be configured with all sorts of parameters, from endpoint connection URIs to message transformation scripts to content-based routing definitions. Moreover, ESBs like Mule can host custom components, which will process messages and perform u...
Representatives of the state IT organizations of Brazil, South Africa and Venezuela, three of the four countries that protested ISO’s standardization of Microsoft’s Office Open XML (OOXML) file format, have apparently thrown in the towel on taking their appeal any further. India, t...
Two of the biggest launches in Rich Internet Application history took place in 2007/2008 when Adobe launched AIR 1.0 in February '08 and Microsoft launched Silverlight (September '07). At the 6th International AJAXWorld RIA Conference & Expo in October SYS-CON Events is delighted to be...
Red Hat CTO Brian Stevens, Citrix CTO Simon Crosby, Egenera CTO Pete Manca, Allen Stewart, Group Manager, Windows Virtualization at Microsoft, and Brian Duckering, Sr. Director of Products and Alliances at Symantec were the top industry executives who joined Jeremy Geelan in the 4th Fl...
This article is aimed at beginner and intermediate Web developers looking to make the leap into database support of their Web site. The article suggests a new declarative language based on HTML-forms, which is used for development of the database interface. HTML forms can manage not on...
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON FEATURED WHITEPAPERS


ADS BY GOOGLE
BREAKING XML NEWS

Security Challenges for the Information Society