You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jean-Claude Moissinac <mo...@enst.fr> on 2004/07/22 18:26:13 UTC
Cocoon use case
Hello
It's a question of implementation 'philosophy' within Cocoon:
how to use some helper applications from Cocoon;
(there is a world outside Cocoon)
And the detailed use case:
I'm using a lot of XML format -IMS, MPEG-4 XMT, MPEG-21 IDL, SVG,
SMIL...- and Coccon seems to be a great framework to produce or modify
(adapt) documents.
The last phase of a lot of my processes is to convert an XML file to
some binary format.
So, the good place for that seems to be in a serializer.
SVGSerializer or ZipArchiveSerializer are good guide for this work.
My problem is:
a lot of converter I have are not directly mapable in a Serializer (for
example, because there are exe or C++)
Typically, they take an XML file and some parameters as input and gives
a binary file as output.
I can't clearly understand how to make the link between these converter
and Cocoon:
INPUT
- attempt to access to the cache from a previous pipeline as file input,
- take all the SAX events to generate the input file
- other
OUTPUT
???
Now, I've made some validation with the following pipelines:
One which assume the dynamically produced xml file is accessible, call
an action which consume the file and produce the binary file
and then use a reader to send the binary file
<map:match pattern="*.mp4">
<map:act type="MP4">
<map:parameter name="contextPath"
value="{request:contextPath}"/>
<map:parameter name="filename" value="{1}"/>
</map:act>
<map:read src="{1}.mp4" mime-type="video/mpeg4"/>
</map:match>
the action is mainly a system call like this:
String cmdLine = new String("mp4box.exe -out
"+path+"\\"+file+".mp4"+" -mp4 "+path+"\\"+file+".xmt");
Process p = Runtime.getRuntime().exec(cmdLine);
and one which just demonstrate the production of the genarated file
<map:match pattern="*.data">
<map:generate type="file" src="{1}_info.xml"/>
<map:transform type="xslt" src="xml2xmt.xsl"/>
<map:serialize type="text"/>
</map:match>