Sha256: 5cb7097774d0d989b6efbb7c1eb75760fcc0e7df67d9dc85ae2645df657de8f1

Contents?: true

Size: 636 Bytes

Versions: 5

Compression:

Stored size: 636 Bytes

Contents

require 'rubygems'

require 'web/htmltools/xmltree'

parser = HTMLTree::XMLParser.new
parser.feed(DATA.read.chomp)
root = parser.document

root.each_recursive { |node|
  name = node.name.downcase
  case name
  when 'form'
    node.each_recursive { |n|
      puts n.name.downcase
    }
  end
}

__END__
<html>
<body>
  <table>
    <tr>
      <td>
        <form name="foo">
        <table>
          <tr><td><h1>Header</h1></td></tr>
          <tr>
            <td>
              <input type="text" name="hey" value="" />
            </td>
          </tr>
        </table>
        </form>
      </td>
    </tr>
  </table>
</body>
</html>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mechanize-0.5.0 test/parse.rb
mechanize-0.5.1 test/parse.rb
mechanize-0.5.2 test/parse.rb
mechanize-0.5.3 test/parse.rb
mechanize-0.5.4 test/parse.rb