Hi Angelo, 

You can convert structured text to XML with "Chaperon" parser generator 
(a parser because it parses the text and generator because it creates 
an XML document) which is integrated in cocoon as a generator.

See for more details:
http://chaperon.sourceforge.net/
http://xml.apache.org/cocoon/howto/chaperon/howto-chaperon-intro.html

My sitemap example:
<map:match pattern="MAST_TXT2MAST_XMLresponse">
    <map:act type="myFileUpload"> <!--action for getting the uploaded 
text file, returning fileName in {src} sitemap parameter-->
        <map:parameter name="file-name" value="mast"/> <!--file-name 
attribute in the HTML form-->
        <map:generate type="textparser" src="{src}"> <!--
text2chaperonXML-->
            <map:parameter name="grammar" value="cocoon:/mast-
out.grm"/> <!--the grammar describing my text file structure and 
vocabulary-->
            <map:parameter name="includeignorabletokens" value="true"/>
        </map:generate>
        <map:transform src="stylesheets/chaperon2mastXML.xsl"/> <!--
chaperonXML2myXML-->
        <map:transform type="myAddDocDB"> <!--save XML to eXist-->
            <map:parameter name="dom-name" value="DBresult"/>
            <map:parameter name="dom-root-element" value="Mast_Result"/>
            <map:parameter name="collection" value="/Ruben"/>
            <map:parameter name="id" value="Robot_Teleoperado.xml"/>
        </map:transform>
        <map:transform type="xalan" src="stylesheets/simple-
xml2html.xsl"/> <!--visualize XML in Mozilla-->
        <map:serialize/>
    </map:act>
</map:match>

<map:match pattern="*.grm"> <!--convert txt grammar to xml grammar-->
    <map:generate type="textparser" src="grammars/{1}.rgrm">
        <map:parameter name="grammar" value="grammars/rgrm.grm"/>
    </map:generate>
    <map:transform src="stylesheets/rgrm2grm.xsl"/>
    <map:serialize type="xml"/>
</map:match>

Oskar


> --- Reçu de       INFETUDE.G145193 02/250.96.71              30-01-03 
08.25
> 
> Hi,
> 
> I am beginner with cocoon.
> I want convert a file text in xml wel form.
> The string text is
>   .SE NAME 'toto       '
>   .SE ADRESS 'xxyy jj    '
>   .SE TEL '01236547'
> ...
> I want convert data in xml
>   <NAME>toto</NAME>
>   <ADRESS>xxyy jj</ADRESS>
>   <TEL>01236547</TEL>
> ...
> It's possible??
> Are you a sample of this use (sitemap and stylesheet)
> 
> Thanks.
> Angelo
> 
> ---- 30-01-03 08.25 ---- Envoyé à      -------------------------------
-----
>   -> [EMAIL PROTECTED]
> 
> 
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
> 
> 
> [EMAIL PROTECTED]
> *******************************************************************
> 
> 
> ---------------------------------------------------------------------
> 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]>
> 
> 





---------------------------------------------------------------------
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]>

Reply via email to