I also tried to retrive using the java api.
I get all the 22 items with /INVOICE/BILL_INVOICE.bill_ref_no
But when I try with /INVOICE/[BILL_INVOICE.bill_ref_no="2"] or
/INVOICE/[BILL_INVOICE.bill_ref_no='2'] I do not get any results.
Appreciate any help.
Thanks,
Sreeni
Here is the code:
*****************************************
package com.edocs.xml;
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
public class CollectionQuery
{
public static void main(String[] args) throws Exception
{
Collection col = null;
try
{
String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
Class c = Class.forName(driver);
String colName = "test";
String xpath = "/INVOICE/BILL_INVOICE.bill_ref_no";
Database database = (Database) c.newInstance();
DatabaseManager.registerDatabase(database);
col = DatabaseManager.getCollection("xmldb:xindice:///db/" +
colName);
long start;
long end;
XPathQueryService service =
(XPathQueryService) col.getService("XPathQueryService", "1.0");
start = System.currentTimeMillis();
ResourceSet resultSet = service.query(xpath);
end = System.currentTimeMillis();
long rsTime = end - start;
start = System.currentTimeMillis();
ResourceIterator results = resultSet.getIterator();
System.out.println("Result Set size: " +
resultSet.getSize() );
end = System.currentTimeMillis();
long iterTime = end - start;
start = System.currentTimeMillis();
int i=0;
while (results.hasMoreResources())
{
i++;
Resource res = results.nextResource();
System.out.println((String) res.getContent());
}
end = System.currentTimeMillis();
System.out.println("Number of items retrieved: " + i);
System.out.println("Time for getting the result set: " + rsTime );
System.out.println("Time for getting the iterator: " +
iterTime );
System.out.println("Time for reading the results: " + (end-start)
);
}
catch (XMLDBException e)
{
System.err.println("XML:DB Exception occured " + e.errorCode);
}
finally
{
if (col != null)
{
col.close();
}
}
}
}
*********************************************************
-----Original Message-----
From: Mark J. Stang [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 05, 2002 1:00 PM
To: [email protected]
Subject: Re: indexing/xpath query question