First "//Message/from/Address[name='dariusjbos']" you have an extra
slash before the '[' second why do the //Message when you know the
structure of the document?

Todd

johan bos wrote:
> 
> Hello Everyone,
> 
> Here my problem,
> I can connect and create a collection (mail)  in xindice 1.1 (from
> within my
> servlet (tomcat 5))
> I can add document to this collection (the ugly browser let me see them)
> 
> but when i try to make a query using the example function for quering
> xindice, i got an error such as below: (some of the message are from my
> debug)
> 
> 
> trying to register database
> Database xmldb:xindice://localhost:8080/db is connected
> Collection xmldb:xindice://localhost:8080/db is connected
> Collection mail already created
> org.xmldb.api.base.XMLDBException: org.apache.xmlrpc.XmlRpcException:
> Error
> Compiling XPath Expression: Une étape d'emplacement était attendue après
> le
> jeton ''/'' ou ''//''.
>     at
> org.apache.xindice.client.xmldb.xmlrpc.CollectionImpl.runRemoteCommand(CollectionImpl.java:119)
> 
>     at
> org.apache.xindice.client.xmldb.xmlrpc.CollectionImpl.query(CollectionImpl.java:515)
> 
>     at
> org.apache.xindice.client.xmldb.XindiceCollection.query(XindiceCollection.java:259)
> 
>     at
> org.apache.xindice.client.xmldb.services.QueryService.query(QueryService.java:90)
> 
>     at jmms.MessageDB.queryCollection(MessageDB.java:163)
>     at jmms.JMMSServlet.doMessageToDB(JMMSServlet.java:1009)
>     at jmms.JMMSServlet.doPost(JMMSServlet.java:342)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> 
>     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 
>     at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> 
>     at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> 
>     at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> 
>     at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> 
>     at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> 
>     at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>     at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
>     at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
> 
>     at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> 
>     at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> 
>     at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> 
>     at java.lang.Thread.run(Unknown Source)
> Query /mail/Message/from/Address/[name='dariusjbos'] return an error
> XML:DB Exception occured 1 org.apache.xmlrpc.XmlRpcException: Error
> Compiling XPath Expression: Une étape d'emplacement était attendue après
> le
> jeton ''/'' ou ''//''.
> 
> the xml document i try to query look like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <Message xmlns="URN:ietf:params:email-xml:"
> rfc822="URN:ietf:params:rfc822:">
>    <date>Mon Aug 15 19:03:47 CEST 2005</date>
>    <from>
>        <Address>
>            <adrs>mailto:[EMAIL PROTECTED]</adrs>
>            <name>dariusjbos</name>
>        </Address>
>    </from>
> </Message>
> //Message/from/Address/[name='dariusjbos']
> find after the function i use to query the mail collection under db:
> 
> public static void queryCollection()throws Exception {
>        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://localhost:8080/db/mail");
> 
>           String xpath = "//Message/from/Address/[name='dariusjbos']";
>           XPathQueryService service =
>              (XPathQueryService) col.getService("XPathQueryService",
> "1.0");
>           ResourceSet resultSet = service.query(xpath);
>           ResourceIterator results = resultSet.getIterator();
>           while (results.hasMoreResources()) {
>              Resource res = results.nextResource();
>              System.out.println((String) res.getContent());
>           }
>        }
>        catch (XMLDBException e) {
>           System.err.println("XML:DB Exception occurred " + e.errorCode
> +
> "" + e.getMessage());
>        }
>        finally {
>           if (col != null) {
>              col.close();
>           }
>        }
> }
> 
> please I really need to pass this problem (deadline in 3 days)
> 
> thanks in advance
> 

Reply via email to