Unless I misunderstand you, you are frighteningly close to being done.

Steve Schwarz wrote:
...

I'd like to allow users to:
1. Upload an xml file
2. Validate it via XSD
3. Save it into my directory tree
4. process it using a number of transforms
5. serialize the transformed doc to the uploading client

So far I've got my config setup to handle uploads.
I (think I) can write an Action that validates the xml to my XSDschema via Xerces and returns an error page if it fails.
I can use the FileUploadAction from Cocoon Developer's Handbook to copy the file into my directory tree .
I also have a pipeline defined for generating/transforming/serializing valid XML files when they are requested directly by a client from within my directory tree.


What I can't figure out is how do I kick off my existing pipeline at the end of the two actions? This seems so basic but all the upload stuff I've seen doesn't re-SAX-ify the uploaded doc and process it (they all use parameters only of the request in the response to the client; not a transformation of the content of the actual file itself).

You have two paths you can take: you can generate from the uploaded file or you can generate from the FilePart object in the request. A brand new generator to do that is sitting at bugzilla, but that won't help you
now, so go with the first.


If I've understood you, this should work:

<map:match ...>
  <map:act type="validate"> <!-- you'll need to write this AFAIK -->
    <map:act type="upload"> <!--save it to disk -->
        <map:generate type="file" src="wherever_you_saved_it"/>
        <map:transform .../>
        <map:serialize .../>
    </map:act>
        <!-- if upload fails -->
        <map:generate ..../>
        <map: ..... />
  </map:act>
        <!-- if validate fails -->
        ...
</map:match>

You could also switch the order of the actions. Let me know if that doesn't make sense.

If you want, you can have the upload action return the location of the
saved file on disk and use it in the src, like {foo} where the location
is put in the returned Map under the key "foo".

Is there a generator that I can apply right after the copy action that will SAX-ify the just copied file so I can use standard pipeline transforms/serializers?

So, if you go with "SAX-ify"ing the uploaded file from disk, you just use the plain old file generator


Can I do something like use redirect after the actions and give it the directory/filename of where I moved the uploaded file in order to have the standard pipeline be applied? If someone has a pseudo pipeline for this I'd really appreciate it.

Sure, you could do that too but nested actions should do the trick.


Any help is greatly appreciated.
Steve Schwarz



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to