cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <DHo...@csir.co.za>
Subject Re: parsing xml code [converting escaped tags?]
Date Mon, 28 Feb 2005 11:25:38 GMT
Vlad

I have never done this; I am still struggling with the htmlArea
component that is used with Cocoon forms... it saves all the
data as escaped tags (as per your example) and that makes
it impossible to post-process... what Cocoon needs is a transformer
that takes a file with escaped tags and converts them to valid XML.

Any takers to code this??

Derek

>>> vlad@top.ee 2005/02/28 01:25:47 PM >>>
Derek,

that was very helpful. It would work if there wouldn't be one moment.
I
noticed that actually all the data in DB is in such format:

&lt;contact&gt;
 &lt;name&gt;Chris&lt;/name&gt;
 &lt;surname&gt;Lautre&lt;/surname&gt;
 &lt;address&gt;Plomipuu 16&lt;/address&gt;
 &lt;email&gt;clautre@datanet.ee&lt;/email&gt;
 &lt;phone&gt;&lt;/phone&gt;
&lt;/contact&gt;

Is it possible to convert it to the normal tags and then apply your
method?

Vlad

"Derek Hohls" <DHohls@csir.co.za> wrote in message
news:s223068b.097@cs-emo.csir.co.za...
> You may need to add in a namespace to the file below to
> make it a valid XML file  e.g.
>
> <pcomponentobjectOut
>   xsi:type="ns2:DBConnection1_ComponentObjectUser"
>   xmlns:xsi="http://apache.org/cocoon/xsi/1.0">
> ...
>
> Then the following works (under my Cocoon 2.1.5):
>
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns:xsi="http://apache.org/cocoon/xsi/1.0"
>   >
>
> <xsl:template match="pcomponentobjectOut">
>  <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="componentClob">
>  <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="contact">
>   <xsl:value-of select="surname"/>,<xsl:value-of select="name"/>
> </xsl:template>
>
> <xsl:template match="*">
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> HTH.
>
>
> >>> vlad@top.ee 2005/02/28 11:41:10 AM >>>
> Hi All,
>
> I have a web service, which returns me code like that:
>
>
--------------------------------------------------------------------------
--
> --
> <pcomponentobjectOut
xsi:type="ns2:DBConnection1_ComponentObjectUser">
>   <componentClob xsi:type="xsd:string"><contact> <name>Chris</name>
> <surname>Lautre</surname> <address>Plomipuu 16</address>
> <email>clautre@datanet.ee</email> <phone></phone> </contact>
<contact>
> <name>Vlad</name> <surname>Golodov</surname> <address>Paasiku
22 -
> 155</address> <email>vlad@top.ee</email> <phone>+37256639190</phone>
> </contact></componentClob>
>   <componentId xsi:type="xsd:decimal">97</componentId>
>   <componentName xsi:type="xsd:string">Address Book For
> Other</componentName>
>   <componentType xsi:type="xsd:string">ADDRESSBOOK</componentType>
>   <dateCreated
> xsi:type="xsd:dateTime">2005-02-21T11:46:50.000Z</dateCreated>
>   <dateUpdated xsi:type="xsd:dateTime" xsi:nil="true" />
>   <description xsi:type="xsd:string">New Address Book For
> Other</description>
>   <groupId xsi:type="xsd:decimal">11</groupId>
>   <newPosts xsi:type="xsd:string" xsi:nil="true" />
>   <ownerUserName xsi:type="xsd:string">clautre</ownerUserName>
>   </pcomponentobjectOut>
>
--------------------------------------------------------------------------
--
> --
>
> In xslt I need to parse componentClob and iterate through the
contact
> tags.
>
> That code gives me the content of the componentClob:
>
>
--------------------------------------------------------------------------
--
> -
> <xsl:template match="*/return/pcomponentobjectOut">
>   <xsl:value-of select="componentClob"
disable-output-escaping="yes"/>
> </xsl:template>
>
--------------------------------------------------------------------------
--
> -
>
> I was trying to iterate through the content of clob, but all was
> vainly.
>
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
> For additional commands, e-mail: users-help@cocoon.apache.org 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
For additional commands, e-mail: users-help@cocoon.apache.org 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message