cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oskar Casquero" <jtaca...@bi.ehu.es>
Subject Re: convert text in xml wel form
Date Thu, 30 Jan 2003 10:27:41 GMT

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

----- Original Message -----
From: "CARLETTA ANGELO" <ANGELO.CARLETTA@PV.BE>
To: <COCOON-USERS@xml.apache.org>
Sent: Thursday, January 30, 2003 8:25 AM
Subject: convert text in xml wel form


--- 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é à      ------------------------------------
  -> COCOON-USERS@XML.APACHE.ORG


**********************************************************************
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.


postmaster@pv.be
*******************************************************************


---------------------------------------------------------------------
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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


---------------------------------------------------------------------
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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message