*** java/src/org/apache/xindice/tools/command/XPathQuery.java Wed Jun 26 17:17:55 2002 --- /Users/vwilliam/Desktop/patched/XPathQuery.java Wed Jun 26 16:59:00 2002 *************** *** 60,65 **** --- 60,66 ---- */ import java.util.Hashtable; + import java.util.StringTokenizer; import java.io.*; import org.xmldb.api.modules.*; *************** *** 93,98 **** --- 94,100 ---- return false; } + String colstring = normalizeCollectionURI( (String)table.get("collection") ); String querystring = (String)table.get("query"); XPathQueryService service = null; *************** *** 106,111 **** --- 108,115 ---- } service = (XPathQueryService)col.getService("XPathQueryService","1.0"); + addNamespaces(service, (String)table.get("namespaces")); + ResourceSet resultSet = service.query(querystring); results = resultSet.getIterator(); *************** *** 131,136 **** --- 135,152 ---- return true; } + private void addNamespaces(XPathQueryService service, String namespacesString) throws XMLDBException { + if ((namespacesString != "") && (namespacesString != null)) { + StringTokenizer st = new StringTokenizer(namespacesString, "=;"); + if (st.countTokens() % 2 != 0) { + System.out.println("ERROR : mismatched namespace prefixes and uris"); + return; + } + while (st.hasMoreTokens()) { + service.setNamespace(st.nextToken(), st.nextToken()); + } + } + } }