I've been using Cocoon2 to access Tamino for a while now. I wrote my own Generator (included below) that uses Tamino's HTTP API. Basically, I submit an XPath query via HTTP, and then generate SAX events from the query results. This avoids DOM instantiation of the query results (which can be quite large).
This generator takes database URL and XPath query parameters as the following sitemap snippet demonstrates... <map:generate type="tamino"> <map:parameter name="dburl" value="http://your_database_url/tamino/your_database_name/"/> <map:parameter name="collection" value="txdocs"/> <map:parameter name="xpath" value="xpath_expression_here"/> </map:generate> make sure to declare it within the <map:generators/> element above as follows... <map:generator name="tamino" src="your_path_to/TaminoGenerator"/> You can also override these parameters with HTTP request parameters of the same name. -Mitch ------Generator Code Here --------------- //package org.apache.cocoon.generation; import org.apache.avalon.excalibur.pool.Recyclable; import org.apache.cocoon.Constants; import org.apache.cocoon.generation.*; import org.apache.cocoon.environment.Request; import org.xml.sax.SAXException; import org.xml.sax.InputSource; import org.xml.sax.helpers.AttributesImpl; import org.apache.xerces.parsers.SAXParser ; import java.util.*; import java.net.* ; import java.io.* ; /** * Generates XML response from a Tamino query using the 3.1 Tamino API. * Process HTTPRequest parameters to configure the query to Tamino. * @author <a href="mailto:[EMAIL PROTECTED]">Mitch christensen</a> */ public class TaminoGenerator extends ServletGenerator implements Recyclable { // put class variables here String mDbURL = null ; String mCollection = null ; Request mRequest = null ; String mDocFrom = null ; String mDocTo = null ; String mXPath = null ; // The URI of the namespace of this generator. private String URI="http://some_id_url"; /** * Generate XML data */ public void generate() throws IOException,SAXException { // get the request parameters getParams() ; // get the data from Tamino InputSource is = getInputSource() ; // now parse the Tamino results SAXParser parser = new SAXParser() ; parser.setContentHandler(this.contentHandler) ; parser.setProperty("http://xml.org/sax/properties/lexical-handler", this.lexicalHandler) ; parser.parse(is) ; } /* * Execute a query with Tamino */ protected InputSource getInputSource() throws IOException, MalformedURLException { // open a network connection to Tamino URL url = new URL(mDbURL + mCollection + "?_xql(" + mDocFrom + "," + mDocTo + ")=" + mXPath) ; // try to connect using stardard HTTP utils HttpURLConnection conn = (HttpURLConnection)url.openConnection() ; // return return new InputSource(conn.getInputStream()) ; } /* * Get the Tamino parameters */ protected void getParams() { // start with the Request object (highest priority) mDbURL = this.request.getParameter("dburl") ; mCollection = this.request.getParameter("collection") ; mXPath = this.request.getParameter("xpath") ; mDocFrom = this.request.getParameter("docfrom") ; mDocTo = this.request.getParameter("docto") ; // any null values should check the sitemap parameters if(mDbURL == null) mDbURL = parameters.getParameter("dburl", "http://localhost/tamino/mydb/") ; if(mCollection == null) mCollection = parameters.getParameter("collection", "ino:etc") ; if(mXPath == null) mXPath = parameters.getParameter("xpath", "/") ; if(mDocFrom == null) mDocFrom = parameters.getParameter("docfrom", "1") ; if(mDocTo == null) mDocTo = parameters.getParameter("docto", "10") ; } } -----Original Message----- From: Kukkapalli PraveenKumar [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 2:55 AM To: [EMAIL PROTECTED] Subject: How can I access XML Native database using cocoon Hi all, I'm new to cocoon and this mailing list as well. I read that Cocoon is supporting Native Databases and downloaded the Cocoon and installed in my machine but I didn't get any Info. from the site that how to access native database. I'm using dbXML(Xindice).My frontend is XML and using DOM.I've to go to so many pages and fill some forms, all the information I've given is stored as DOM and whenever I submit that should submit to the database. Does it supports.Please let me know.. Best wishes Praveen --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]> --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>