cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geurt Wisselink" <>
Subject RE: SQL Transformer Bug?
Date Sat, 18 Nov 2006 18:56:32 GMT
Dear Dan,

I ran into the same problem and ended up modifying the transformer.
I returned the modified version to the cocoon development group.

I added two options to work with xml.

The first was the original foreseen sql:xml construct.
Basically it works like this:
<sql:execute-query xmlns:sql="">
<sql:query name="nodeset">
INSERT INTO mytable (nodeset)
VALUES ('<sql:xml><root><record id="1"><name>John 

In this way a string is created with the XML content in side.

The second thing I added was the capability to work with xml variables by
means of the sql:in-xml-parameter.
It works like the standard in-parameter but is tailored to work with XML
This works like:
<sql:execute-query xmlns:sql="">
<sql:in-xml-parameter nr="1"><root><record id="1"><name>John 
<sql:query name="nodeset">
INSERT INTO mytable (nodeset)

The modified SQLTransformer is added as attachment to this mail. 
Just put it src\blocks\databases\java\org\apache\cocoon\transformation, and
rerun build.

This last option is the best for last XML blocks, because the data is
streamed to the database engine, instead of embedding it into a SQL query.

I hope this helps.

Kind regards,

Geurt Wisselink

-----Original Message-----
From: Dan Hertz [] 
Sent: 18 November 2006 17:10
Subject: SQL Transformer Bug?

I'm hoping someone can help me troubleshoot why I can't insert an xml 
nodeset into my database using the SQL Transformer. All I end up with is 
the text() values concatenated together -- no elements or attribute 
nodes. For example:

<sql:execute-query xmlns:sql="">
<sql:query name="nodeset">
INSERT INTO mytable (nodeset)
VALUES ('<root><record id="1"><name>John 

would insert: 1JohnSmithLondon into my database.

If I plug this query into my sql editor, I correctly get:
<root><record id="1"><name>John 
inserted into the database.

What am I doing wrong?


View raw message