xml-xindice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saqib.N....@seagate.com
Subject Re: PB : url to connect xindice started on tomcat
Date Wed, 02 Apr 2003 13:59:28 GMT

Hi Jeremie,

I am not sure if I understood you question, but here is some that might
help you:

import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;



public class linuxfaq extends HttpServlet {


    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {

        ResourceBundle rb =
            ResourceBundle.getBundle("LocalStrings",request.getLocale());
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();

    try{
    //out.println( request.getParameter("firstname"));
    Class c =
Class.forName("org.apache.xindice.client.xmldb.DatabaseImpl");
    Database database = (Database) c.newInstance();
    DatabaseManager.registerDatabase(database);
    org.xmldb.api.base.Collection col =
DatabaseManager.getCollection("xmldb:xindice:///db/faq");

        String xpath = request.getParameter("query");
         //String xpath =
"//article/articleinfo/author/firstname[='Saqib']";
         XPathQueryService service =
            (XPathQueryService) col.getService("XPathQueryService",
"1.0");
         ResourceSet resultSet = service.query(xpath);
         ResourceIterator results = resultSet.getIterator();
         while (results.hasMoreResources()) {
            Resource res = results.nextResource();
            out.println(((String) res.getContent()).replaceAll("xml
version=\"1.0\"?>", "saqib"));
         }

    }

   catch (Exception e){out.print("exception" + e.toString());}
   //   finally {
   //      if (col != null) {
   //         col.close();
   //      }
   //   }

}


In Peace,
Saqib Ali
http://www.seagate.com/cheetah/


|---------+--------------------------->
|         |           "Jeremie hattat"|
|         |           <Jeremie.hattat@|
|         |           orange.fr>      |
|         |           No Phone Info   |
|         |           Available       |
|         |                           |
|         |           04/02/2003 05:55|
|         |           AM              |
|         |           Please respond  |
|         |           to xindice-users|
|         |                           |
|---------+--------------------------->
  >-------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                      
                                        |
  |        To:      "xindice-users" <xindice-users@xml.apache.org>                 
                                              |
  |        cc:                                                                           
                                        |
  |        Subject: PB : url to connect xindice started on tomcat                        
                                        |
  >-------------------------------------------------------------------------------------------------------------------------------|




I'm running an xindice1.1b with a tomcat 4.1.24.

i can't find the url : database.getCollection(#url#) to connect the
database started with putting the war in tomcat.

Can somebody help me?

Thanks in advance...

Jeremie








Mime
View raw message