Dan Hertz wrote:
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="http://apache.org/cocoon/SQL/2.0";>
<sql:query name="nodeset">
INSERT INTO mytable (nodeset)
VALUES ('<root><record id="1"><name>John Smith</name><city>London<city></record></root>');
</sql:query>
</sql:execute-query>

would insert: 1JohnSmithLondon into my database.

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



My guess is that the XML is getting interpreted and the startElement/endElement SAX events just get ignored. Maybe if you try wrapping the XML in a CDATA section, that way the whole thing will be treated as a text node:

INSERT INTO mytable (nodeset)
VALUES ('<![CDATA[<root><record id="1"><name>John Smith</name><city>London<city></record></root>]]>');

Reply via email to