Todd, I actually use a Java servlet to access the database. The code below is what I used (I found this code on the website):
----------------------------------- Collection col = null; try { String driver = "org.apache.xindice.client.xmldb.DatabaseImpl"; Class c = Class.forName(driver); Database database = (Database) c.newInstance(); DatabaseManager.registerDatabase(database); col = DatabaseManager.getCollection("xmldb:xindice:///db/phonebook"); String xpath = "//phonebook[name='Tom' and number='07989270142']"; XPathQueryService service = (XPathQueryService) col.getService ("XPathQueryService", "1.0"); ResourceSet resultSet = service.query(xpath); ResourceIterator results = resultSet.getIterator(); while (results.hasMoreResources()) { Resource res = results.nextResource(); String outcome = (String) res.getContent(); System.out.println(outcome) }//while }//try catch (XMLDBException e) { System.err.println("XML:DB Exception occured " + e.getMessage()); }//catch catch (Exception ie) { System.err.println("XML:DB Exception occured " + ie.getMessage()); }//catch ----------------------------------- I use this in a class which my servlet calls. It works fine in some respect. I can search for everything in the database, and it returns null if no records have been found. However, using the OR operator, it returns the same record twice. Can you see what the problem might be? Thanks Gul Quoting Todd Byrne <[EMAIL PROTECTED]>: > Hi Gul, > > I ran your query from the command line on your sample document in a > test > database and it only returned one record like I expected. Are you > sure > this record isn't in more then one document or repeated in your > document? > > here is the command I ran: xindice xpath -c /db/test -q > "//phonebook[name='Tom' or number='07989270142']" > > and my output: > <?xml version="1.0"?> > <phonebook xmlns:src="http://xml.apache.org/xindice/Query" > src:col="/db/test" src:key="test"> > <name>Tom</name> > <number>07989270142</number> > </phonebook> > > I am using version 1.0 still. > > Maybe you can discribe your problem in a tad more depth and I would be > glad to continue to help. > > Todd Byrne > > On Thu, 2002-12-05 at 09:58, Gul Akbar wrote: > > Hello, > > > > I have this problem with my XPath Query. > > > > //phonebook[ name='Tom' or number='07989270142' ] > > > > This returns the same record twice, and I know that there is only one > of those > > records. The XML that is stored: > > > > <phonebook> > > <name>Tom</name> > > <number>07989270142</number> > > </phonebook> > > > > Can anyone please tell me why this record is being returned twice when > I use > > the boolean operator "OR" (shown in the XPATH above). > > > > Thanking you in advance > > Gul > > > > ------------------------------------------------- > > This mail sent through IMP: webmail.brad.ac.uk > > ------------------------------------------------- This mail sent through IMP: webmail.brad.ac.uk