You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Nina Juliadotter <nv...@it.uts.edu.au> on 2004/04/21 05:33:09 UTC

xmldb namespace in xindice results file

Hi everyone,

I've come across a strange problem that I'm not sure how to get around, or if it's
just me doing something wrong.

Short description:
When I use cocoon to query the xindice database and display the results, the result
file generated has an undeclared namespace "xmldb". This has the effect that I can't
do anything with the result, as cocoon will tell me that "The prefix "xmldb" for
element "xmldb:results" is not bound." How do you get around this???

Long description:
When I query xindice with a sitemap like this:

<map:pipeline>
    <map:match pattern="styleremote/**">
      <map:generate src="xmldb:xindice://localhost:8080/db/restaurants/#{1}"/>
<map:transform type="xslt" src="xsl/result.xsl"/>
      <map:serialize type="html"/>
    </map:match>
  </map:pipeline>

and the url is

http://localhost:8080/cocoon/nina1/styleremote/restaurant[name='La Scala']

then the "<map:generate src="xmldb:xindice://localhost:8080/db/restaurants/#{1}"/>"
bit generates the following:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmldb:results query="/restaurant[name='La Scala']" resources="1"> <xmldb:result
docid="LaScala">
<restaurant src:col="/db/restaurants" src:key="LaScala"
xmlns:src="http://xml.apache.org/xindice/Query">
  <name>La Scala</name>
    <cousineType>Italian</cousineType>
    <address>
        <streetNumber>23</streetNumber>
        <streetName>Norton street</streetName>
        <suburb>Leichhardt</suburb>
    </address>
    <phoneNumber>(02) 9765 4321</phoneNumber>
    <menuURL>http://www.lascala.com.au/menu</menuURL>
    <bookingURL>http://www.lascala.com.au/booking</bookingURL>
    <priceRange>
        <minPrice>10</minPrice>
        <maxPrice>40</maxPrice>
    </priceRange>
</restaurant>
</xmldb:result>
</xmldb:results>

My style sheet is just a "print everyting out":

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
  <html>
  <table>
	<tr><td><xsl:apply-templates /></td></tr>
  </table>
  </html>
</xsl:template>
</xsl:stylesheet>

Cocoon gives me the error:

org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
file:/C:/Tomcat/webapps/cocoon/nina1/LaScala.xml:2:67:org.xml.sax.SAXParseException:
The prefix "xmldb" for element "xmldb:results" is not bound.

Obviously this could be solved by adding a declaration of xmldb namespace in both
the generated file and the stylesheet. But this is not realistic as I need to work
with the generated result on the fly, and anyway, I shoudln't have to.

Any ideas?

Thanks,
Nina


Re: xmldb namespace in xindice results file

Posted by Vadim Gritsenko <va...@reverycodes.com>.
IIRC, xmldb is Cocoon's namespace, so this seems to be Cocoon's problem. 
You can patch XMLDBSource and send patch to Cocoon's Bugzilla.

Vadim


Nina Juliadotter wrote:

>Hi everyone,
>
>I've come across a strange problem that I'm not sure how to get around, or if it's
>just me doing something wrong.
>
>Short description:
>When I use cocoon to query the xindice database and display the results, the result
>file generated has an undeclared namespace "xmldb". This has the effect that I can't
>do anything with the result, as cocoon will tell me that "The prefix "xmldb" for
>element "xmldb:results" is not bound." How do you get around this???
>
>Long description:
>When I query xindice with a sitemap like this:
>
><map:pipeline>
>    <map:match pattern="styleremote/**">
>      <map:generate src="xmldb:xindice://localhost:8080/db/restaurants/#{1}"/>
><map:transform type="xslt" src="xsl/result.xsl"/>
>      <map:serialize type="html"/>
>    </map:match>
>  </map:pipeline>
>
>and the url is
>
>http://localhost:8080/cocoon/nina1/styleremote/restaurant[name='La Scala']
>
>then the "<map:generate src="xmldb:xindice://localhost:8080/db/restaurants/#{1}"/>"
>bit generates the following:
>
><?xml version="1.0" encoding="ISO-8859-1"?>
><xmldb:results query="/restaurant[name='La Scala']" resources="1"> <xmldb:result
>docid="LaScala">
><restaurant src:col="/db/restaurants" src:key="LaScala"
>xmlns:src="http://xml.apache.org/xindice/Query">
>  <name>La Scala</name>
>    <cousineType>Italian</cousineType>
>    <address>
>        <streetNumber>23</streetNumber>
>        <streetName>Norton street</streetName>
>        <suburb>Leichhardt</suburb>
>    </address>
>    <phoneNumber>(02) 9765 4321</phoneNumber>
>    <menuURL>http://www.lascala.com.au/menu</menuURL>
>    <bookingURL>http://www.lascala.com.au/booking</bookingURL>
>    <priceRange>
>        <minPrice>10</minPrice>
>        <maxPrice>40</maxPrice>
>    </priceRange>
></restaurant>
></xmldb:result>
></xmldb:results>
>
>My style sheet is just a "print everyting out":
>
><?xml version="1.0" ?>
><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
><xsl:output method="html" indent="yes"/>
><xsl:template match="/">
>  <html>
>  <table>
>	<tr><td><xsl:apply-templates /></td></tr>
>  </table>
>  </html>
></xsl:template>
></xsl:stylesheet>
>
>Cocoon gives me the error:
>
>org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
>file:/C:/Tomcat/webapps/cocoon/nina1/LaScala.xml:2:67:org.xml.sax.SAXParseException:
>The prefix "xmldb" for element "xmldb:results" is not bound.
>
>Obviously this could be solved by adding a declaration of xmldb namespace in both
>the generated file and the stylesheet. But this is not realistic as I need to work
>with the generated result on the fly, and anyway, I shoudln't have to.
>
>Any ideas?
>
>Thanks,
>Nina
>
>
>  
>