mechanize:Mechanize::Page#parser, #root
以下のような HTML で
<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-style-type" content="text/css"> <meta http-equiv="content-script-type" content="text/javascript"> <title>meta test</title> </head> <body> </body> </html>
>> require 'mechanize' => true >> agent = Mechanize.new => #<Mechanize:0xb747b2e4 ... >> page = agent.get('http://127.0.0.1:8080/test07_meta.html') => #<Mechanize::Page {url #<URI::HTTP:0xb7477a2c URL:http://127.0.0.1:8080/test07_meta.html>} {meta} {title "meta test"} {iframes} {frames} {links} {forms}> >> page.parser => #<Nokogiri::HTML::Document:0x..fdba39e80 name="document" children=[#<Nokogiri::XML::DTD:0x..fdba372f2 name="html">, #<Nokogiri::XML::Element:0x..fdba39e6c name="html" children=[#<Nokogiri::XML::Element:0x..fdba36e56 name="head" children=[#<Nokogiri::XML::Element:0x..fdba397f0 name="meta" attributes=[#<Nokogiri::XML::Attr:0x..fdba36cb2 name="http-equiv" value="content-type">, #<Nokogiri::XML::Attr:0x..fdba36ca8 name="content" value="text/html; charset=utf-8">]>, #<Nokogiri::XML::Element:0x..fdba39764 name="meta" attributes=[#<Nokogiri::XML::Attr:0x..fdba369a6 name="http-equiv" value="content-style-type">, #<Nokogiri::XML::Attr:0x..fdba3699c name="content" value="text/css">]>, #<Nokogiri::XML::Element:0x..fdba396ce name="meta" attributes=[#<Nokogiri::XML::Attr:0x..fdba3669a name="http-equiv" value="content-script-type">, #<Nokogiri::XML::Attr:0x..fdba36690 name="content" value="text/javascript">]>, #<Nokogiri::XML::Element:0x..fdba391d8 name="title" children=[#<Nokogiri::XML::Text:0x..fdba362bc "meta test">]>]>, #<Nokogiri::XML::Element:0x..fdba361b8 name="body" children=[#<Nokogiri::XML::Text:0x..fdba36078 "\n\n">]>]>]> >> page.parser.children[0] => #<Nokogiri::XML::DTD:0x..fdba372f2 name="html"> >> page.parser.children[1] => #<Nokogiri::XML::Element:0x..fdba39e6c name="html" children=[#<Nokogiri::XML::Element:0x..fdba36e56 name="head" children=[#<Nokogiri::XML::Element:0x..fdba397f0 name="meta" attributes=[#<Nokogiri::XML::Attr:0x..fdba36cb2 name="http-equiv" value="content-type">, #<Nokogiri::XML::Attr:0x..fdba36ca8 name="content" value="text/html; charset=utf-8">]>, #<Nokogiri::XML::Element:0x..fdba39764 name="meta" attributes=[#<Nokogiri::XML::Attr:0x..fdba369a6 name="http-equiv" value="content-style-type">, #<Nokogiri::XML::Attr:0x..fdba3699c name="content" value="text/css">]>, #<Nokogiri::XML::Element:0x..fdba396ce name="meta" attributes=[#<Nokogiri::XML::Attr:0x..fdba3669a name="http-equiv" value="content-script-type">, #<Nokogiri::XML::Attr:0x..fdba36690 name="content" value="text/javascript">]>, #<Nokogiri::XML::Element:0x..fdba391d8 name="title" children=[#<Nokogiri::XML::Text:0x..fdba362bc "meta test">]>]>, #<Nokogiri::XML::Element:0x..fdba361b8 name="body" children=[#<Nokogiri::XML::Text:0x..fdba36078 "\n\n">]>]> >> page.parser.children[1].to_s => "<html>\n<head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n<meta http-equiv=\"content-style-type\" content=\"text/css\">\n<meta http-equiv=\"content-script-type\" content=\"text/javascript\">\n<title>meta test</title>\n</head>\n<body>\n\n</body>\n</html>"