Re: Re: Suggestions for a tool or method to create an editable XML-based form.

Tod Harter <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
I would have thought this module might be more useful if it was designed to
take an input hash with keys and generate an output DOM. That seems to be
the core functionality, instead of subclassing CGI and etc. I know for your
application that is probably fine, but in general OO terms the functionality
would be more generally useful if it was decoupled from CGI.pm. Using it
from CGI.pm then requires maybe 1-2 extra lines of code, but you gain the
ability to use it in a lot of other places.

Actually I wrote pretty close to the same thing, except my version takes a
'mapping hash' which maps the input form field names to the xpath
expressions and then applies them to an existing DOM. A BIT more complex in
terms of calling it, and you need an existing DOM to insert the data into,
but you have the virtue of not requiring form field names to be expressions
(which gets pretty awkward if you have existing forms or you need to do
client side stuff with the fields in javascript). The only other advantage
being you don't have to implement any expression parsing logic in the module
itself because you can use LibXML's XPath.

The other thing I did with mine was attach an XSD type expression to each
field in my map. That will let you nail down exactly what is allowed in the
input fairly tightly. Maybe I should dig it up and post it... ;)

On Wed, Mar 11, 2009 at 1:54 PM, Atanas Karashenski <[email protected]>wrote:

> For the 'mapping' of form fields to XML document you can use the
> following module. As a result of HTML form processing it returns a DOM
> object. Note that it allows you to have xml element with as many as you
> want children stored in a single html form - it is very useful when you
> have to 'move' some data through several web pages.
>
> Tthe module requires CGI.pm module and XML::LibXML libraries only. You
> can put it wherever you want and to rename it according to your needs. I
> have plans to upload it to CPAN ... some day.
>
> http://www.blueboard.biz/cdir/blueboard.biz/files/XMLForm.pm
>
> I hope it will help
>
> Atanas Karashenski
> BlueBoard LLC
>
> Tod Harter wrote:
> > Hmmm, well, I have done a bunch of these sorts of things. You can do a
> > few things. Write an XSLT stylesheet to translate the invoice into a
> > form, that gets you your UI for entering/editing stuff. Going the
> > other way you could pretty easily write a 'mapping' which provides a
> > form field name to XPATH expression mapping in order to stuff things
> > back in (coding that is pretty simple).
> >
> > On Tue, Mar 10, 2009 at 7:26 AM, Robin Berjon <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> >     On Mar 9, 2009, at 23:18 , Howard, Chris wrote:
> >     > But, I have this nagging feeling that there must be some simpler
> >     > tool for doing this, particularly the tricky bits of saving
> >     > state between calls to CGI.pm.
> >
> >     Sideways question: does it have to run in a browser, and any browser
> >     at that? What you describe sounds a lot like XForms. There's a
> Firefox
> >     extension for it (and a bunch of plugins or server transcoders).
> >
> >     >  Maybe I should be writing this
> >     > in Java or something.
> >
> >     That's never the solution.
> >
> >     --
> >     Robin Berjon - http://berjon.com/
> >         Feel like hiring me? Go to http://robineko.com/
> >
> >
> >
> >
> >
> >     _______________________________________________
> >     Perl-XML mailing list
> >     [email protected]
> >     <mailto:[email protected]>
> >     To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >
> >
> >
> >
> > --
> > The Wise adapts himself to the world. The Fool adapts the world to
> > himself. Therefore, all progress depends on the Fool.
>



-- 
The Wise adapts himself to the world. The Fool adapts the world to himself.
Therefore, all progress depends on the Fool.

_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.