cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Refondini <patrick.refond...@pobox.com>
Subject Re: content-type=text/xml output, how to configure
Date Fri, 10 Nov 2006 09:07:43 GMT
Hank Ratzesberger wrote:
> 
> Thanks very much for the friendly welcome.
> 
> I must admit that I probably should be asking at the eXist list, but 
> eXist is really just a ... pupae.
> 
> In any case, if I get the document (actual url on request):
> 
> http://myhost/exist/rest/db/css30/sitechans.xml
> 
> It returns as a text/xml .
> 
> If I request
> http://myhost/exist/rest/db/css30/sitechans.xml?_query=//sitechan[sta='GVDA']&_indent=yes

> 
> 
> It is text/html but otherwise a valid subset of the xpath result.
> 
> I've changed the default serialzer to xml, and the xml serialzer I 
> instructed to include the xml declaration.  Neither made any difference 
> to the output, so I am presuming that it is not even handled by the xml 
> serializer (somehow).

Possible, hard to tell without knowing more about your sitemap and how 
you hook up to exist db

> 
> Please consider the issue closed.  I will bring it up with the eXist group.
Good luck,

Patrick

> 
> Best,
> Hank
> 
>  <map:serializers default="xml">
>    <map:serializer mime-type="text/xml" name="xml" 
> src="org.apache.cocoon.serialization.XMLSerializer">
>      <encoding>UTF-8</encoding>
>      <omit-xml-declaration>no</omit-xml-declaration>
>    </map:serialzer>
>    <map:serializer mime-type="text/xml" name="html" ...
> 
> 
> 
>      <encoding>UTF-8</encoding>
>      <omit-xml-declaration>no</omit-xml-declaration>
> 
> 
> 
> 
> ----- Original Message ----- From: "Patrick Refondini" 
> <patrick.refondini@pobox.com>
> To: <users@cocoon.apache.org>
> Sent: Thursday, November 09, 2006 3:41 PM
> Subject: Re: content-type=text/xml output, how to configure
> 
> 
>> Hi Hank,
>>
>> Hank Ratzesberger wrote:
>>>
>>> I am using the eXist database which is built on Cocoon.  It has a 
>>> REST interface that accepts
>>> XPath and XQuery request parameters.
>>>
>>> My problem is that the returned content-type is
>>> text/html, but I want to force it to be text/xml.
>>>
>>> Is there a bare minimum sitemap.xmap file that I can start with? It 
>>> seems like I change the piplelines and default serializer, etc., etc.,
>>> but I get the same results.
>>
>> Maybe this simple example might help:
>>
>> In a test sitemap.xmap add:
>>
>>   <map:match pattern="HTML_*">
>>     <map:generate src="{1}.xml" />
>>     <map:serialize type="html"/>
>>   </map:match>
>>
>>   <map:match pattern="XML_*">
>>     <map:generate src="{1}.xml" />
>>     <map:serialize type="xml"/>
>>   </map:match>
>>
>> Then define a file test1.xml containing:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <div xmlns="http://www.w3.org/1999/xhtml">
>> <table border="1" width="50%">
>> <tbody>
>> <tr>
>> <td>HTML namespace</td>
>> <td>http://www.w3.org/1999/xhtml</td>
>> </tr>
>> </tbody>
>> </table>
>> </div>
>>
>> Then define a file test2.xml containing:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <div>
>> <table border="1" width="50%">
>> <tbody>
>> <tr>
>> <td>Default namespace</td>
>> <td>nada</td>
>> </tr>
>> </tbody>
>> </table>
>> </div>
>>
>> Finally given a URL context ${YOUR_URL} with your browser hit:
>>
>> ${YOUR_URL}/XML_test1
>> ${YOUR_URL}/HTML_test1
>> ${YOUR_URL}/XML_test2
>> ${YOUR_URL}/HTML_test2
>>
>> Looking at your browser page source will show you four different 
>> results, the first one being likely the result you want.
>>
>> For more information on e.g. controlling encoding you may want to read:
>>
>> http://cocoon.apache.org/2.1/userdocs/xml-serializer.html
>>
>> I hope this helps,
>>
>> Patrick
>>
>>>
>>> Regards from a first time visitor,
>>>
>>> Hank Ratzesberger
>>> Goleta, CA
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message