Select * From World where type="computing";
How To Use XUpdate In Java With Xindice Database
This Tutorial is available in PDF Book : How To Use XUpdate In Java With Xindice Database
The aim of this tutorial is to show you how to develop a simple java class that use CRUD (Create Read Update Delete ) operations with an xml file stored in a native XML Database.
firstly to begin you should download those tools:
- Launching the server and adding the XML file to the native database :
- Update XML database in java
- add a new person : -A persons farid safiri 25 farid@gmail.com
- Remove the 4th person : -R persons 4
- update the second person : -E persons 2 steve Mcarty 21 sMcarty@gmail.com
- Execute XPath expression in java
let’s begin our project ,we should create a xml file for example called persons.xml in whish we add some person elements ,each person has different nodes(first name,last name,email ,age) this is an example of persons.xml :
We created the xml file let’s now store this file in Xindice database ,to do that we should start the server, open the Xindice Folder called xindice-1.0 –>launch startup.bat, to verify if the server is executed correctly open your navigator and show http://localhost:4080/ page if you saw an xindice page that means the server is launched without errors.
Next step is to launch Xindice Browser which give us many options to look to the database (open XindiceBrowser and execute XIndiceBrowser.bat
To add the Xml file to the XML database we should create a Collection in whish we will store this file:
Now let’s add persons.xml file to the new collection :
we finished the first step of configuration and insertion of XML file in native database,next step is to create a javaa classe wishes manipulate the XML file stored in the database.
open Eclipse Galileo IDE and create a new Java Project called test_xindice ,click the right mouse into the project and select Properties , in the properties window select Java Build Path –> Libraries , then click the Add External JARs… Button , select the 5 jar’s in the java–> lib folder (see the next image)
classe called xupdate and add this code to your class :
Download xupdate.java
to execute this class we should modify the run configuration of the eclipse IDE to do that select in principal menu run–>run configuration–>Arguments , enter one of this arguments:
after writhing one of those case in the argument section click run, you will see the xupdate code in the eclipse console, for example if we write the first option adding a new person to the persons.xml file stored in the database we will see the request like this :
The code produced by the program and executed in the server :
for more informations about how to use XUpdate UseCases
now let’s see the modification in Xml database, move to XIndice Database Browser click the refresh button and select persons.xml file you will see that the forth person is added to the database :
In the same way you can execute author options of removing or updating an element in the XML database .
To learn XPath : XPath Tutorial
create a simple java class called show_xml and copy this file to your class:
show_xml.java
execute this file and you will see the result in eclipse console like this :
finally you achieved the mission of updating a XML Database and showing the XPath Result using java and Xindice Database, you can now create more complex application based on XML database .












about 11 months ago
I discovered your weblog web site on google and test just a few of your early posts. Proceed to maintain up the superb operate. I simply further up your RSS feed to my MSN Information Reader. Seeking ahead to studying more from you in a while!
about 11 months ago
very nice publish, i certainly love this website, carry on it