Majcen, Kurt wrote:
> Hi all!
>
> I'm rather new with Cocoon but I think I've got a somehow tricky question:
>
> In my ORACLE database XML formatted records are stored e.g. for users (also
> for other types of records but these are the easy ones I want to try with)
> in CLOB fields - so the record could look like:
<snip/>
I'd use a generator instead of an action. No need to store the retrieved
XML in a file and read it again via XSP.
You can find an example here [1]. I'll comment the relevant parts:
PreparedStatement ps = ...;
ResultSet rs = ps.executeQuery(); // execute query and retrieve the
result set
while (rs.next()) {
// CONTENT is the CLOB column
insertXML(rs.getClob("content").getCharacterStream(), parser);
}
...
// The insertXML method parses the CLOB column as XML and inserts
// it as SAX events in the pipeline.
private void insertXML(Reader reader, Parser parser)
throws SAXException, IOException
{
InputSource is = new InputSource(reader);
parser.parse(is, new IncludeXMLConsumer(xmlConsumer));
}
I hope this is helpful and correct.
Ugo
[1]:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/cocoblog/CocoBlog/src/java/com/beblogging/generation/RSSGenerator.java?rev=1.1&content-type=text/vnd.viewcvs-markup
--
Ugo Cei - http://www.bebloggging.com/blog/
---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>