Peter Szinek
2008-Dec-07 02:11 UTC
[Mechanize-users] Construct a mechanize document from String
Hey guys, This must be something dead easy but for the life of me I can''t figure out how! Let''s say I have a string: garbage = <<-SZ <html> <body> <table> <tr><td>1</td></tr> <tr><td color="red">2</td></tr> <tr><td>3</td></tr> </table> </body> </html> SZ I''d like to construct a new document from it, something like my_string_doc = WWW::Mechanize.new.get(garbage) Any ideas? Cheers, Peter
Martin Sarsale
2008-Dec-08 12:23 UTC
[Mechanize-users] Construct a mechanize document from String
> I''d like to construct a new document from it, something like > > my_string_doc = WWW::Mechanize.new.get(garbage)I use this for feeding mechanize with my own forms WWW::Mechanize::Form.new(form); -- Martin Sarsale - martin at malditainternet.com
Michael Libby
2008-Dec-08 12:23 UTC
[Mechanize-users] Construct a mechanize document from String
On Sat, Dec 6, 2008 at 8:11 PM, Peter Szinek <peter at rubyrailways.com> wrote:> Hey guys, > > This must be something dead easy but for the life of me I can''t figure out > how! > > Let''s say I have a string: > > garbage = <<-SZ > <html> > <body> > <table> > <tr><td>1</td></tr> > <tr><td color="red">2</td></tr> > <tr><td>3</td></tr> > </table> > </body> > </html> > SZ > > I''d like to construct a new document from it, something like > > my_string_doc = WWW::Mechanize.new.get(garbage) > > Any ideas?page = WWW::Mechanize::Page.new(nil, {''content-type'' => ''text/html''}, garbage) _________________ Michael C. Libby www.mikelibby.com