You need to use the setNamespace method of the XPathQueryService, to specify any prefix to namespace mappings that you are going to use within your query. For example:
service = (XPathQueryService)collection.getService("XPathQueryService","1.0"); service.setNamespace("ns1","Alma/ObsPrep/ObsProject"); ResourceSet resultSet= service.query(query); - Tom -----Original Message----- From: Simon Farrow [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 5:25 PM To: xindice users Subject: Querying with namespaces I realize that this was discussed a little while ago but I couldn't seem to find any final answer. I'm trying to query a document that uses namespaces throughout. Not using namespaces is not an option for us. An excerpt from the document is below: <?xml version="1.0" encoding="UTF-8"?> <ns1:ObsProject xmlns:ns1="Alma/ObsPrep/ObsProject"> <ns1:ObsProjectEntity entityId="uid://X0000000000000001/X00000100" entityIdEncrypted="-- id encryption not yet implemented --" entityTypeName="ObsProject"/> <ns1:ObsProposalRef entityId="uid://X0000000000000001/X00000101" entityTypeName="ObsProposal" entityVersion="latest"/> <ns1:ObsProgram code="aaa"> the query I'm trying to perform is very simple /ns1:ObsProject This should select every document with this root node in the database. all this is being done with code that looks like: service = (XPathQueryService)collection.getService("XPathQueryService", "1.0"); ResourceSet resultSet= service.query(query); where query is the string obove. this query causes an exception to be thrown: org.xmldb.api.base.XMLDBException: Query error Does anyone have any clue how I can get this query to return something. The same query without the namespace returns no results. Thanks, Simon Farrow.