Re: Problem to Xquery a document from xindice collection

"Lisa McCabe" <[email protected]>
Newsgroups gmane.text.xml.xindice.user
Message-ID <007301c5a1fd$654d26c0$8ed3d442@MegaCool>
Hi,

Did you try the same query using the commandline Xindice to see if your
xpath query works? That helps me in firguring out my problems. I am doing
the same type of stuff and compared our code - yours is the same as mine so
it should work.

-Lisa McCabe

PS Good luck meeting your deadline!

----- Original Message -----
From: "johan bos" <[email protected]>
To: <[email protected]>
Sent: Monday, August 15, 2005 1:57 PM
Subject: Problem to Xquery a document from xindice collection


>
> 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(Colle
ctionImpl.java:119)
> at
>
org.apache.xindice.client.xmldb.xmlrpc.CollectionImpl.query(CollectionImpl.j
ava:515)
> at
>
org.apache.xindice.client.xmldb.XindiceCollection.query(XindiceCollection.ja
va:259)
> at
>
org.apache.xindice.client.xmldb.services.QueryService.query(QueryService.jav
a: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(Application
FilterChain.java:252)
> at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
> at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)
> at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va: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.processConne
ction(Http11Protocol.java:744)
> at
>
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)
> at
>
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:80)
> at
>
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a: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>
>
> 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
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.