logo       

Re: Problem to Xquery a document from xindice collection: msg#00007

Subject: Re: Problem to Xquery a document from xindice collection
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" <dariusjb@xxxxxxxxxxx>
To: <xindice-users@xxxxxxxxxxxxxx>
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:dariusjbos@xxxxxxx</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
>
>




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe