You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by praktikant <pr...@feltengmbh.de> on 2002/08/19 08:44:21 UTC

Cocoon and Xindice

Hello!
I'm a newbie. I tried to use the /db/addressbook shipped with Xindice. I've
found some examples on http://cocooncenter.de. But the examples didn't run
yet.
If I try to run this :	(db_test.xml)

<?xml version="1.0" encoding="UTF-8"?>
<collection:results query="//person[contains(fname,'John')]"
  resources="1" xmlns:collection="http://apache.org/cocoon/xmldb/1.0">
  <collection:result docid="address1">
    <person xmlns:src="http://xml.apache.org/xindice/Query"
      src:col="/db/addressbook"
      src:key="address1">
      <fname>John</fname>
      <lname>Smith</lname>
      <phone type="work">563-456-7890</phone>
      <phone type="home">534-567-8901</phone>
      <email type="home">jsmith@somemail.com</email>
      <email type="work">john@lovesushi.com</email>
      <address type="home">34 S. Colon St.</address>
      <address type="work">9967 W. Shrimp Ave.</address>
    </person>
  </collection:result>
</collection:results>

I only get the xml-source (above) on the Browser! ???

This is the part of the sitemap.xmap:
...
<map:pipeline>
  <map:match pattern="db_test" type="wildcard">
   <map:generate src="db_test.xml" type="file"/>
   <map:serialize type="xml"/>
  </map:match>
 </map:pipeline>
...
------------------------------
if I type this 
http://localhost:8080/cocoon/xmldb/addressbook/?xpath=//person[contains(fnam
e,'John')
<http://localhost:8080/cocoon/xmldb/addressbook/?xpath=//person[contains(fna
me,'John')> ]
in my browser I get all data about John.
------------------------------
So I ask you some questions:

Do you know what I have done wrong?
How do cocoon know which DB I want to use in the xml-file?

I use Win 2k, Tomcat 4.0.4, Cocoon 2.0.3 (compiled on Java 1.3.x), Xindice
1.0, Java SDK 1.3.1_04

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Cocoon and Xindice

Posted by John Moylan <jo...@rte.ie>.
This may be of some use to you, it's a snippet from my sitemap showing 
the use of stylesheets with Xindice. Note the use of <map:transform 
src="stylesheets/jtest.xsl"></map:transform>
You are also serializing as XML specifically in your sutemap which from 
your email, does not sound like the effect you require. Try serializing 
to html instead.

>>How do cocoon know which DB I want to use in the xml-file?

You tell cocoon the collection(db) you want to use in the URL. eg the following URL is using the addressbook collection(db).


http://localhost:8080/cocoon/xmldb/addressbook/?xpath=//person[contains(fnam
e,'John')

Regards,
John







<map:match pattern="xmldb/**">
                <map:match pattern="xpath" type="request-parameter">
                        <map:generate 
src="xmldb:xindice://localhost:4080/db/{../1}#{1}"/>
                        <map:transform src="stylesheets/jtest.xsl">
                        </map:transform>
                        <map:serialize/>
                </map:match>
                <map:generate src="xmldb:xindice://localhost:4080/db/{1}"/>
                <map:transform src="stylesheets/jtest.xsl">
                </map:transform>
                <map:serialize/>

praktikant wrote:

>Hello!
>I'm a newbie. I tried to use the /db/addressbook shipped with Xindice. I've
>found some examples on http://cocooncenter.de. But the examples didn't run
>yet.
>If I try to run this :	(db_test.xml)
>
><?xml version="1.0" encoding="UTF-8"?>
><collection:results query="//person[contains(fname,'John')]"
>  resources="1" xmlns:collection="http://apache.org/cocoon/xmldb/1.0">
>  <collection:result docid="address1">
>    <person xmlns:src="http://xml.apache.org/xindice/Query"
>      src:col="/db/addressbook"
>      src:key="address1">
>      <fname>John</fname>
>      <lname>Smith</lname>
>      <phone type="work">563-456-7890</phone>
>      <phone type="home">534-567-8901</phone>
>      <email type="home">jsmith@somemail.com</email>
>      <email type="work">john@lovesushi.com</email>
>      <address type="home">34 S. Colon St.</address>
>      <address type="work">9967 W. Shrimp Ave.</address>
>    </person>
>  </collection:result>
></collection:results>
>
>I only get the xml-source (above) on the Browser! ???
>
>This is the part of the sitemap.xmap:
>...
><map:pipeline>
>  <map:match pattern="db_test" type="wildcard">
>   <map:generate src="db_test.xml" type="file"/>
>   <map:serialize type="xml"/>
>  </map:match>
> </map:pipeline>
>...
>------------------------------
>if I type this 
>http://localhost:8080/cocoon/xmldb/addressbook/?xpath=//person[contains(fnam
>e,'John')
><http://localhost:8080/cocoon/xmldb/addressbook/?xpath=//person[contains(fna
>me,'John')> ]
>in my browser I get all data about John.
>------------------------------
>So I ask you some questions:
>
>Do you know what I have done wrong?
>How do cocoon know which DB I want to use in the xml-file?
>
>I use Win 2k, Tomcat 4.0.4, Cocoon 2.0.3 (compiled on Java 1.3.x), Xindice
>1.0, Java SDK 1.3.1_04
>
>---------------------------------------------------------------------
>Please check that your question  has not already been answered in the
>FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
>To unsubscribe, e-mail:     <co...@xml.apache.org>
>For additional commands, e-mail:   <co...@xml.apache.org>
>
>  
>




******************************************************************************
The information in this e-mail is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this e-mail by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
Please note that emails to, from and within RT� may be subject to the Freedom
of Information Act 1997 and may be liable to disclosure.
******************************************************************************

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Cocoon and Xindice

Posted by kavitha ramesh <ka...@yahoo.co.in>.
Hi,

You have written that you get the xml data in the
browser.If you need a html file in the browser, you
have to use a stylesheet and your sitemap should be as
follows:


<map:pipeline>
<map:match pattern="db_test">
<map:generate src="db_test.xml"/>
<map:transform src="db_test.xsl"/>
<map:serialize/>
</map:match> 
</map:pipeline>

You should have a stylesheet db_test.xsl!

Kavitha



________________________________________________________________________
Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!!
       visit http://in.autos.yahoo.com

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>