Hello.

I have a working XMLForm. I want to add the generated data in the last step
to a Xindice database.
I also have the XMLDBTransformer configured and working just fine.

In case you haven't heard of the XMLDBTransformer, it takes a XML file or
string and works with it. For example, the insert action expects something
like this:
   <xindice:query type="create" oid="user-id">
     <person>
            <username>johndoe</username>
            <email>[EMAIL PROTECTED]</email>
     </person>
   </xindice:query>

Where the information for the <person> is added to the database.

Now, how can I link those?
I can think of some possibilities:
1.- Use java code in my custom action, so in the confirm step I could open
the connection to Xindice and store the data.
2.- Make the confirm page not a XML page but a XSP one. I could add logic to
retrieve the model bean data there and add it to Xindice.
3.- Similar to #2 but I only produce there the needed XML entry for the
XMLDB transformer and feed it after processing the XSP.
4.- Develop a new custom transformer. It would get the form data and format
it according to the format expected by the XMLDB transformer so it could
feed it.
5.- Forget the previous possibilities. Just make a custom XSLT. This will be
in the sitemap right after the xmlform transformation. And after that it
will feed the XMLDBTransformer.

I have serious doubts on what approach I should take. I don't like #1 too
much, cause it ties the Form to Xindice implementation. I like #2 or #3
more, cause right now I think #4 is too difficult for me. I tried to code
the XSP in #2 and #3 but there's an obvious problem when using the
getObjectModel() method, so I should look for a way to retrieve the my form
object from the session so this approach is getting complicated.more.

I also coded #4, I feel it separates concerns better and it's a good
approach from a sitemap's perspective. It does a good job, I can send the
code snippet if needed. But I'm not completely satisfied with it. In the
example above, I want to validate if the username already exists in the DB
and add a violation to the XMLForm if it does, so the user should choose
another one.

Well, after reading dozens of XMLForm related messages in the archive I
think I can understand better when Ivelin says he prefers Java for complex
logic and not XSP. I'm thinking of taking #1 approach after all, making a
helper bean to query the Xindice database and use it in my action, but
though it will make XMLForm<-> Xindice interactions way easier, I don't like
the idea pretty much. I'd be using a transformer into an action and it won't
be any clear in the sitemap. Now, with approach #4 you can see clearly
you're just chaining transformations and my custom action is DB independent
too, and I like it.

What do you all think? Would it be so bad? Maybe I'm just being very picky
at this...stupid me...I need some sleep...

Thanks for reading.


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