You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by E Smith <E....@bham.ac.uk> on 2003/07/14 17:11:32 UTC
Parsing jelly:http results with jelly:html
Does anyone have any examples of how to use jelly:http tags to retrieve HTML pages? I've been trying to do:
<?xml version="1.0"?>
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:html="jelly:html" xmlns:http="jelly:http">
<html:parse var="bhamHomepage">
<http:get url="http://www.bham.ac.uk" />
</html:parse>
<x:copyOf select="$bhamHomepage" />
</j:jelly>
But nothing's coming back from the http:get tag. I've also had problems trying to get the uri and path attributes working for http:get, and stumbled on "url" by guesswork. (I know I could use the "html" attribute of the html:parse tag, but need to use the http tags so I have access to request parameters and can do POSTs.)
I'm using Jelly 1.0-dev. Any help much appreciated. (Perhaps I should be using 1.0-beta-3?)
Thanks
Elliot Smith
Re: Parsing jelly:http results with jelly:html
Posted by Bill Keese <bi...@tech.beacon-it.co.jp>.
HTTP tags are working for me but I am saving the output to a variable.
<http:get url="..." var="outVar"/>
Looking at the code, unfortunately, this seems to be necessary. Note
that "outVar" is a HTTPMethod class (see
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpMethod.html
)
with various fields, including
${outVar.responseBodyAsStream} and ${outVar.responseBodyAsString} and
${outVar.responseTime}
So, if I remember correctly, you would cal
<html:parse var="myXMLDocument">${outVar.responseBodyAsString} </html:parse>
or something like that.
E Smith wrote:
>Does anyone have any examples of how to use jelly:http tags to retrieve HTML pages? I've been trying to do:
>
><?xml version="1.0"?>
><j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:html="jelly:html" xmlns:http="jelly:http">
>
> <html:parse var="bhamHomepage">
> <http:get url="http://www.bham.ac.uk" />
> </html:parse>
>
> <x:copyOf select="$bhamHomepage" />
>
></j:jelly>
>
>But nothing's coming back from the http:get tag. I've also had problems trying to get the uri and path attributes working for http:get, and stumbled on "url" by guesswork. (I know I could use the "html" attribute of the html:parse tag, but need to use the http tags so I have access to request parameters and can do POSTs.)
>
>I'm using Jelly 1.0-dev. Any help much appreciated. (Perhaps I should be using 1.0-beta-3?)
>
>Thanks
>Elliot Smith
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
>
>