Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6906B200C74 for ; Sun, 30 Apr 2017 01:42:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5CBBA160BB7; Sat, 29 Apr 2017 23:42:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5658E160BA9 for ; Sun, 30 Apr 2017 01:42:03 +0200 (CEST) Received: (qmail 78890 invoked by uid 500); 29 Apr 2017 23:41:56 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 78878 invoked by uid 99); 29 Apr 2017 23:41:56 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Apr 2017 23:41:56 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 01CA6C0349 for ; Sat, 29 Apr 2017 23:41:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.498 X-Spam-Level: X-Spam-Status: No, score=-1.498 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-2.796, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id dwTxE9JkAx65 for ; Sat, 29 Apr 2017 23:41:51 +0000 (UTC) Received: from smtpauths.lb.bluewin.ch (vimdzmsp-sfwd06.bluewin.ch [195.186.227.133]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id EC6885F642 for ; Sat, 29 Apr 2017 23:41:50 +0000 (UTC) Received: from [192.168.1.22] ([83.77.27.48]) by vimdzmsp-sfwd06.bluewin.ch Swisscom AG with SMTP id 4bzjdXKolOQ9I4bzjdNwEi; Sun, 30 Apr 2017 01:41:43 +0200 X-Bluewin-Spam-Analysis: v=2.1 cv=cYwf1i3M c=1 sm=1 tr=0 a=x5sHqKJuQaoKG6sVZC2pHA==:117 a=x5sHqKJuQaoKG6sVZC2pHA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=jw9MEW4z1itAmWNOOxMA:9 a=pILNOxqGKmIA:10 a=SSmOFEACAAAA:8 a=5WdAb-7O4xYUyGbfjXgA:9 a=7LMhODeBRFb_7STh:21 a=_W_S_7VecoQA:10 X-Bluewin-Spam-Score: 0.00 X-FXIT-IP: IPv4[83.77.27.48] Epoch[1493509304] X-Bluewin-AuthAs: phfaehndrich@bluewin.ch To: users@cocoon.apache.org References: <852DD8A9FDDF734C809AC3CFCFDE8695015C1349F6@WSMV115.corp.vishayint.com> From: Philippe Faehndrich Subject: Is there a way to inject tags in a text field from Cocoon 2.1 into MySQL using sql:execute-query? Message-ID: <1f736d6d-2e8c-9f7b-a730-7cacf3b77794@bluewin.ch> Date: Sun, 30 Apr 2017 01:41:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <852DD8A9FDDF734C809AC3CFCFDE8695015C1349F6@WSMV115.corp.vishayint.com> Content-Type: multipart/alternative; boundary="------------AB4463DF00810F0CE87F6A28" X-CMAE-Envelope: MS4wfEZQ9AXl9aJeNDafN7XkPZX+SrB9cpYM48lnXYD/9l2DaXzydxGM38sptRRcihytL1OpgPaY3mFl3porm06dRzB/4ioEd3PJjZj5aQpjy27tDThYQDkY YVht1bdbMADUa7E3YmWkyeTQ7+7IU7ZwhHNtk1ipYx7Ueb0MDQ6nN+LKvYse2Z/NRlI/wUrjYc6HIg== archived-at: Sat, 29 Apr 2017 23:42:04 -0000 --------------AB4463DF00810F0CE87F6A28 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Hi everybody, I'm working since many years with Cocoon 2.1 within a Tomcat server and I need now to inject the content of my XML files in a MySQL database. The problem is I have some XML elements (MySQL columns) that do contain HTML tags (some "
", "..." and a few "). For now, all tags seem simply to be trimmed away from my output. Is there a way to inject tags in a text field from Cocoon 2.1 into MySQL using ? My database connection is defined as following in WEB-INF/cocoon.xconf: jdbc:mysql://localhost:3306/dautrepart webapp webapp In the sitemap, I have these lines: And concerned parts of my stylesheet appears as follow: INSERT INTO auteur (nom, prenom, identifiant, biographie, portrait_petit) VALUES (" ", " ", " ", " ", " ") An extract of the file I have: Boissier Laurence boissier_laurence_150x100.png Ne en 1965, elle habite dans le canton de Genve. Participe Bern ist berall et au cd Renens (VD) . Prix suisse de littrature 2017 pour Inventaire des lieux paru chez art&fiction.
--------------AB4463DF00810F0CE87F6A28 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit Hi everybody,

I'm working since many years with Cocoon 2.1 within a Tomcat server and I need now to inject the content of my XML files in a MySQL database.

The problem is I have some XML elements (MySQL columns) that do contain HTML tags (some "<br/>", "<i>...</i>" and a few "<a href url="..."/>).

For now, all tags seem simply to be trimmed away from my output.

Is there a way to inject tags in a text field from Cocoon 2.1 into MySQL using <sql:execute-query>?

My database connection is defined as following in WEB-INF/cocoon.xconf:

<jdbc name="dautrepart">
<pool-controller min="1" max="10"/>
<dburl>jdbc:mysql://localhost:3306/dautrepart</dburl>
<user>webapp</user>
<password>webapp</password>
</jdbc>

In the sitemap, I have these lines:

<map:match pattern="copier.html">
<map:generate type="xpathdirectory" src="../bac_a_sable/textes" label="content">
<map:parameter name="xpath" value="/fiche"/>
<map:parameter name="include" value=".xml"/>
</map:generate>
<map:transform src="nettoyer_structure.xslt" label="debug01"/>
<map:transform src="preparer_sql.xslt" label="debug02"/>
<map:transform src="injection.xslt" label="requetes"/>
<map:transform type="sql">
<map:parameter name="use-connection" value="dautrepart"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>

And concerned parts of my stylesheet appears as follow:

<sql:execute-query>
<sql:query name="inserer_auteur">
<xsl:text>INSERT INTO auteur (nom, prenom, identifiant, biographie, portrait_petit) VALUES ("</xsl:text>
<xsl:value-of select="identite/nom"/>
<xsl:text>", "</xsl:text>
<xsl:value-of select="identite/prenom"/>
<xsl:text>", "</xsl:text>
<xsl:value-of select="identite/@id"/>
<xsl:text>", "</xsl:text>
<xsl:apply-templates select="bio"/>
<xsl:text>", "</xsl:text>
<xsl:value-of select="identite/portrait"/>
<xsl:text>")</xsl:text>
</sql:query>
</sql:execute-query>

<xsl:template match="bio">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="i">
<i>
<xsl:apply-templates/>
</i>
</xsl:template>

An extract of the file I have:

<fiche>
<identiteid="boissier_laurence">
<nom>Boissier</nom>
<prenom>Laurence</prenom>
<portrait>boissier_laurence_150x100.png</portrait>
</identite>
<bio>
Ne en 1965, elle habite dans le canton de Genve. Participe Bern ist berall et au cd
<i>Renens (VD)</i>
. Prix suisse de littrature 2017 pour
<i>Inventaire des lieux</i>
paru chez art&fiction.
<br/>
</bio>


--------------AB4463DF00810F0CE87F6A28--