You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sandor Spruit <sa...@cs.uu.nl> on 2001/02/15 14:13:54 UTC

[Q] Grab complete XML documents from a database ?

cocoon-users,

I'm fiddling and experimenting with Cocoon to see how it works. As an
exercise, I'd like to load my XML documents from a database, based on
the request URI, before they get processed by Cocoon.

I've already written a custom Producer to achieve this, but I've some
funny feeling this can be done easier, e.g. by using database code in
Turbine or some XSP trick. Note: I want to get the *whole* document
from the database, i.e. not insert an XML fragment based on a query
that will later be rendered as a HTML table.

Could anyone out there point me in the right direction ?
Thanks in advance,

Sandor

-- 
ir A.G.L. Spruit, Utrecht University, the Netherlands
Institute of information and computing sciences
"There is a bit of magic in everything, and then some
loss to even things out" (from: Lou Reed, "Magic and Loss")



Re: [Q] Grab complete XML documents from a database ?

Posted by Marcelo Ochoa <mo...@ieee.org>.
Hi:

>>>>>>>>>>>>>>>>>> Mensaje original <<<<<<<<<<<<<<<<<<

El 15/2/01, 10.13.54, Sandor Spruit <sa...@cs.uu.nl> escribió sobre el 
tema [Q] Grab complete XML documents from a database ?:


> cocoon-users,

> I'm fiddling and experimenting with Cocoon to see how it works. As an
> exercise, I'd like to load my XML documents from a database, based on
> the request URI, before they get processed by Cocoon.

> I've already written a custom Producer to achieve this, but I've some
> funny feeling this can be done easier, e.g. by using database code in
> Turbine or some XSP trick. Note: I want to get the *whole* document
> from the database, i.e. not insert an XML fragment based on a query
> that will later be rendered as a HTML table.

> Could anyone out there point me in the right direction ?
> Thanks in advance,
 If you are using Oracle Databases you could use DB Prism Content 
Management System to store and retrieve XML documents from the DB.
  Obviously DB Prism has more functionality to make XML applications, 
check for the DB Prism project at: http://www.plenix.com/dbprism/

> Sandor
  Best regards, Marcelo.



RE: C1.8.2 XInclude Processor failed on URL, but fine with local file uri

Posted by Dafang Zhang <da...@wcom.com>.
Hi,

Never mind.  I found the reason myself.

For those interested, here is the reason -- the url (http://host/foo.xml)
provided in xinclude:href is under the same webserver, therefore, it's
handled by cocoon.  The output from cocoon is not a XML doc, since there's
no any stylesheet attached to the foo.xml.  This causes

XIncludeProcessor.java
  line 384:  included_document = parser.parse(input, false);

to be null.

After I put the foo.xml in another not _cocoonized_ web site, everything
went just perfect. :)

By the way, the similar thing happens when using util:include-uri.

Cheers.
Dafang

> -----Original Message-----
> From: Dafang Zhang [mailto:dafang.zhang@wcom.com]
> Sent: Thursday, February 15, 2001 3:02 PM
> To: cocoon-users@xml.apache.org
> Subject: C1.8.2 XInclude Processor failed on URL, but fine with local
> file uri
>
>
> Hi,
>
> I'm using XInclude processor in either xsp page or non-xsp xml:
>
> 1. Fine with file uri, even relative path:
>    <xinclude:include xinclude:parse="xml"
>                      xinclude:href="../../../usr/bar/foo.xml"/>
>
> 2. Failed on a URL (it _IS_ a valid url):
>    <xinclude:include xinclude:parse="xml"
>                      xinclude:href="http://hostname/foo.xml"/>
>
> After tracking down to the source code, the included_document
> variable in
> line 396 is null:
>
> line 396: result =
> document.importNode(included_document.getDocumentElement(),true);
>
> java.lang.NullPointerException
> 	at
> org.apache.cocoon.processor.xinclude.XIncludeProcessor$XInclud
eProcessorWork
> er.processXIncludeElement(XIncludeProcessor.java:396)
> 	at
> org.apache.cocoon.processor.xinclude.XIncludeProcessor$XInclud
eProcessorWork
> er.process(XIncludeProcessor.java:227)
> 	at
> org.apache.cocoon.processor.xinclude.XIncludeProcessor.process
> (XIncludeProce
> ssor.java:139)
> 	at org.apache.cocoon.Engine.handle(Engine.java:384)
> 	at org.apache.cocoon.Cocoon.service(Cocoon.java:183)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
> 	at com.livesoftware.jrun.JRun.runServlet(JRun.java:321)
> 	at
> com.livesoftware.jrun.JRunGeneric.handleConnection(JRunGeneric
.java:116)
> 	at
> com.livesoftware.jrun.service.web.JRunWebServiceHandler.handle
> Output(JRunWeb
> ServiceHandler.java:266)
> 	at
> com.livesoftware.jrun.service.web.JRunWebServiceHandler.handle
> Request(JRunWe
> bServiceHandler.java:234)
> 	at
> com.livesoftware.jrun.service.ThreadConfigHandler.run(ThreadCo
nfigHandler.ja
> va:96)
>
>
> Thanks.
> Dafang
>
>
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>


C1.8.2 XInclude Processor failed on URL, but fine with local file uri

Posted by Dafang Zhang <da...@wcom.com>.
Hi,

I'm using XInclude processor in either xsp page or non-xsp xml:

1. Fine with file uri, even relative path:
   <xinclude:include xinclude:parse="xml"
                     xinclude:href="../../../usr/bar/foo.xml"/>

2. Failed on a URL (it _IS_ a valid url):
   <xinclude:include xinclude:parse="xml"
                     xinclude:href="http://hostname/foo.xml"/>

After tracking down to the source code, the included_document variable in
line 396 is null:

line 396: result =
document.importNode(included_document.getDocumentElement(),true);

java.lang.NullPointerException
	at
org.apache.cocoon.processor.xinclude.XIncludeProcessor$XIncludeProcessorWork
er.processXIncludeElement(XIncludeProcessor.java:396)
	at
org.apache.cocoon.processor.xinclude.XIncludeProcessor$XIncludeProcessorWork
er.process(XIncludeProcessor.java:227)
	at
org.apache.cocoon.processor.xinclude.XIncludeProcessor.process(XIncludeProce
ssor.java:139)
	at org.apache.cocoon.Engine.handle(Engine.java:384)
	at org.apache.cocoon.Cocoon.service(Cocoon.java:183)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
	at com.livesoftware.jrun.JRun.runServlet(JRun.java:321)
	at com.livesoftware.jrun.JRunGeneric.handleConnection(JRunGeneric.java:116)
	at
com.livesoftware.jrun.service.web.JRunWebServiceHandler.handleOutput(JRunWeb
ServiceHandler.java:266)
	at
com.livesoftware.jrun.service.web.JRunWebServiceHandler.handleRequest(JRunWe
bServiceHandler.java:234)
	at
com.livesoftware.jrun.service.ThreadConfigHandler.run(ThreadConfigHandler.ja
va:96)


Thanks.
Dafang


Re: [Q] Grab complete XML documents from a database ?

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 15 Feb 2001, Sandor Spruit wrote:

> I'm fiddling and experimenting with Cocoon to see how it works. As an
> exercise, I'd like to load my XML documents from a database, based on
> the request URI, before they get processed by Cocoon.
>
> I've already written a custom Producer to achieve this, but I've some
> funny feeling this can be done easier, e.g. by using database code in
> Turbine or some XSP trick. Note: I want to get the *whole* document
> from the database, i.e. not insert an XML fragment based on a query
> that will later be rendered as a HTML table.

<xsp:page
  ...
>

<page>

<esql:connection>
  ...
  <esql:get-xml column="data"/>
</esql:connection>

</page>

</xsp:page>

okay, you've got an extraneous root page element to contend with, but so
what?

- donald