XINDICE Hints


XINDICE is an open source based XML document managagement system and maintained by the APACHE organisation. It is written in Java.
More information on XML related developments can be found on APACHE

I will update this site with more informations whenever I find something which I think could be interesting to everyone.

More information on XINDICE can also be found on: www.xindice.org

Downloads

As the batch files which comes with XINDICE contains some errors (better stated: they do not seem to work correctly) I have changed them - based on some hints which I got through:
Corrected XINDICE bat files for Windows for /xindice-xx/bin directory

I have also started developing a simple Perl module which uses XINDICE XML-RPC. This is still under development. It is based on the Frontier::Client module (description and XML-RPC) and requires that you have installed the XML-RPC interface for XINDICE (http://xindice-xmlrpc.sourceforge.net). Any comments or bug reports are appreciated.
You can download it here: xindice.pm
Just create a directory wktm in one of your Perl lib directories (I always use /perl/lib) and copy the pm file into it.
An example how to use the module can be downloaded from here: testrpc.pl.
Installing XINDICE as a service on Windows NT / XP / 2000 can be done by modifying the batch files contained in service.zip
Usage requires to adapt some of the pathes in xindice_service_install.bat.
Pathes to adapt:
c:\Programme\Java\j2sdk1.4.0\jre\bin\server
c:\Programme\xml-xindice-1.0
xindice.exe is a renamed tomcat.exe. This version comes from the latest FORTE for Java from SUN implementation. It may be necessary to copy tools.jar ("c:\Programme\xml-xindice-1.0\JRE\lib\tools.jar") from the JAVA installation into the resp. directory. The files should be copied into XINDICEs bin directory. Thanks to Walter Meyer for support in creating the batch files.
In addition one needs to create two empty files service.out and service.err in the $XINDICE_HOME/logs directory, otherwise the service fails without an error message. Thanks to Carlos Santos for this hint!

Some hints when using XINDICE

Although there is a lot of documentation available for XINDICE some items are not very clear and it took me some time to find out what works and what does not work.

Some hints when using XINDICE embedded version (xindice.war)

This is a rather hard and frustrating experience - at least for Windows (XP) users. Also all was installed it was nearly impossible to access that collection db. After sending this question to the users group I got at least one useful answer:
http://localhost:5080/xindice/Xindice?/db
works. Please note that in my installation Tomcat is running on port 5080.
One of the big questions I had where is the db created when I use the embedded version? As I did not find much documentation I had to experiment (I am talking about Windows). It really depends when you start Xindice (resp.Tomcat). If you start Tomcat as a service it is very likely that you will find the db in the directory [drive:]/windows/system32 (or however your Windows installation is called). You can change the location of the db by modifying the system.xml in the tomcat directory ../webapps/xindice/web-inf. I did the following change:
<?xml version="1.0"?>

<!--
  - Version: $Revision: 1.8 $ $Date: 2002/11/02 06:23:50 $
  - Author: Kimbro Staken (kstaken@xmldatabases.org)
  -->

<xindice>
   <root-collection dbroot="c:/programme/xindice1.1/db/" name="db">
      <queryengine>
         <resolver autoindex="false" class="org.apache.xindice.core.query.XPathQueryResolver" />
         <resolver class="org.apache.xindice.core.xupdate.XUpdateQueryResolver" />
      </queryengine>
   </root-collection>
</xindice> 
Now the db should be created and used from the directory c:/programme/xindice1.1/db/.

I have modified the above mentioned Perl module which works for Xindice 1.0 for running with the embedded version too. You can download it here: xindice_1_1.pm. Youd have to rename it to xindice.pm and follwow the instructions above, It should support both the old and new version (but I never really tested it for the old version :-)). Here some examples how to use it:

# initialise the xindice perl object (1 indicates some debugging, 0 for normal operations)
# if you use the old version of xindice an additional parameter set to 1 like
# ('http://localhost:5080/xindice///db', 1, 1) has to be used
my $testxin = new wktm::xindice('http://localhost:5080/xindice///db', 1);
$testxin->setCollection("/db/test/warneu"); # set a collection; this is important as it will be used as the default collection for most of the operations
my $result = $testxin->queryCollection("//trans-unit[contains(source, 'Tools')]"); # query a collection
my $result = $testxin->queryAllCollections("/tmx/body/tu[\@creationid='20020730T073316Z#2#836791078']");
foreach my $elem (@$result)
{
	print $elem . "\n";
}

$testxin->createCollection("test"); # create a collection in the current set collection
$result = $testxin->listCollections; # list collections in current collection
foreach my $elem (sort @$result)
{
	print $elem . "\n";
} 
$result = $testxin->listAllCollections; # list all collections starting with current set collection
$testxin->dropCollection(); # drop the current set collection
$testxin->dropIndexer("segindex"); # drop a collection in the current set colletion !
$testxin->createIndexer("tuvindexneu", "tuv"); # create an indexer
$result = $testxin->listIndexers; # list indexers
# store a document
my $content = "blabla";
my $result = $testxin->insertDocument("mysmallxml", $content);
# list all the documents in the current selection
my $result = $testxin->listDocuments;
foreach my $elem (sort @$result)
{
	print $elem . "\n";
}
# get a first document from /db/test/ali
my $result = $testxin->listDocuments;
my @list = @$result;
my $docresult = $testxin->getDocument($list[0]);
print $docresult; print "\n";
# get document count from /db/test/ali
print  $testxin->getDocumentCount . "\n";

The perl module contains some additional functions. I hope I can document them sooner or later.

TMX Example File

The example xml files I refer to above all look like this:
<?xml version='1.0' encoding='UTF-8' ?>
<tmx version='1.3'>
<header
	- some info - here.....
</header>
<body>
	<tu tuid='1' creationid='20020730T073158Z#1#831020580'>
		<prop type='sourceFile'>xxxxx</prop>
		<prop type='targetFile'>yyyyy</prop>
		<prop type='sourceSegNumber'>1</prop>
		<prop type='targetSegNumber'>1</prop>
		<tuv xml:lang="en" creationid='20020730T073158Z#1#831020580.en'>
			<seg>blabla</seg>
		</tuv>

		<tuv xml:lang="sv" creationid='20020730T073158Z#1#831020580.sv'>
			<seg>blabla</seg>
		</tuv>
	</tu>
	...
</body>
</tmx>

www.waldhor.com

Impressum

Prof. Dr. Klemens Waldhör

Haftungshinweis:
Trotz sorgfältiger inhaltlicher Kontrolle übernehmen wir keine Haftung für die Inhalte externer Links. Für den Inhalt der verlinkten Seiten sind ausschließlich deren Betreiber verantwortlich.

Datenschutzerklärung/hinweis:
Diese Website benutzt Google Analytics, einen Webanalysedienst der Google Inc. (Google). Google Analytics verwendet sog. Cookies, Textdateien, die auf Ihrem Computer gespeichert werden und die eine Analyse der Benutzung der Website durch Sie ermöglicht. Die durch den Cookie erzeugten Informationen über Ihre Benutzung dieser Website (einschließlich Ihrer IP-Adresse) wird an einen Server von Google in den USA übertragen und dort gespeichert. Google wird diese Informationen benutzen, um Ihre Nutzung der Website auszuwerten, um Reports über die Websiteaktivitäten für die Websitebetreiber zusammenzustellen und um weitere mit der Websitenutzung und der Internetnutzung verbundene Dienstleistungen zu erbringen. Auch wird Google diese Informationen gegebenenfalls an Dritte übertragen, sofern dies gesetzlich vorgeschrieben oder soweit Dritte diese Daten im Auftrag von Google verarbeiten. Google wird in keinem Fall Ihre IP-Adresse mit anderen Daten, die von Google gespeichert werden, in Verbindung bringen. Sie können die Installation der Cookies durch eine entsprechende Einstellung Ihrer Browser Software verhindern; wir weisen Sie jedoch darauf hin, dass Sie in diesem Fall gegebenenfalls nicht sämtliche Funktionen dieser Website voll umfänglich nutzen können. Durch die Nutzung dieser Website erklären Sie sich mit der Bearbeitung der über Sie erhobenen Daten durch Google in der zuvor beschriebenen Art und Weise und zu dem zuvor benannten Zweck einverstanden.