hotshot has asked for the wisdom of the Perl Monks concerning the following question:

Hello guy!

I'm using CGI for my web application. The client side sends me XML (XMLHttpRequest). Is there a way to capture this request dirctly to an XML object that I can manipulate using XPath for example and not as a string and using param().

Thanks

Hotshot

Replies are listed 'Best First'.
Re: XMLhttp
by gellyfish (Monsignor) on Jun 18, 2003 at 09:09 UTC

    I had originally intended the module CGI::XMLPost to be a lightweight replacement for CGI where the only stuff being posted was going to be XML and for the received XML to be processed however the receiving application saw fit. But being bored I thought that it really wouldn't be that much trouble to add an as_xpath() method to it which would do what you want :-) So if you download the 1.3 version of CGI::XMLPost it should suit your purposes.

    /J\
    

Re: XMLhttp
by Zaxo (Archbishop) on Jun 18, 2003 at 07:59 UTC

    If the xml comes in as a cgi query, you're stuck with parsing it out of the query first. You may as well use CGI.pm for that. You can certainly do this, however:

    use XML::XPath; my $xp = XML::XPath -> new( xml => $cgi->param('foo');

    After Compline,
    Zaxo