We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http://nokogiri.org/tutorials/modifying_an_html_xml_document.html at very bottom:
Wrapping a NodeSet
If you wanted to wrap new HTML around each node in a Nodeset, here’s an example of how to do it:
nodes = @doc.css "h1,div" wrapper = nodes.wrap("<div class='container'></div>")
nodes = @doc.css "h1,div"
wrapper = nodes.wrap("<div class='container'></div>")
@doc.to_html # => # ~> /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:235:in 'wrap': undefined method 'parse' for nil:NilClass (NoMethodError) # ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:214:in 'each' # ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:213:in 'upto' # ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:213:in 'each' # ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:234:in 'wrap' # ~> from -:6
@doc.to_html
# =>
# ~> /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:235:in 'wrap': undefined method 'parse' for nil:NilClass (NoMethodError)
# ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:214:in 'each'
# ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:213:in 'upto'
# ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:213:in 'each'
# ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:234:in 'wrap'
# ~> from -:6
The text was updated successfully, but these errors were encountered:
Reproduced. Will look into it.
Sorry, something went wrong.
fixes NodeSet#wrap on fragment nodes. closed by 157a884
No branches or pull requests
http://nokogiri.org/tutorials/modifying_an_html_xml_document.html
at very bottom:
Wrapping a NodeSet
If you wanted to wrap new HTML around each node in a Nodeset, here’s an example of how to do it:
nodes = @doc.css "h1,div"
wrapper = nodes.wrap("<div class='container'></div>")
@doc.to_html
# =>
# ~> /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:235:in 'wrap': undefined method 'parse' for nil:NilClass (NoMethodError)
# ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:214:in 'each'
# ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:213:in 'upto'
# ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:213:in 'each'
# ~> from /home/miked/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/xml/node_set.rb:234:in 'wrap'
# ~> from -:6
The text was updated successfully, but these errors were encountered: