Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #2861

Re: removing nodes from Nokogiri::XML::NodeSet

From 7stud -- <bbxx789_05ss@yahoo.com>
Newsgroups comp.lang.ruby
Subject Re: removing nodes from Nokogiri::XML::NodeSet
Date 2011-04-14 12:34 -0500
Organization Service de news de lacave.net
Message-ID <710026eb14181b797131cfc98b12e535@ruby-forum.com> (permalink)
References <124883eae0d1e5dcae64297d4872ee9d@ruby-forum.com>

Show all headers | View raw


Ted Flethuseo wrote in post #992628:
> Hi everyone,
>
> I am having trouble removing a node from a Nokogiri::XML::NodeSet, not
> sure what
> I should use to remove a specific node at a given position.
>
> I have tried the following but it doesn't seem to work:
>
> puts nodes.length
> nodes[0].remove
> puts nodes.length
>
>
> Ted

Consider this example:


str = "hello \n world"
arr = str.split " "
p arr

--output:--
["hello", "world"]

str.delete!(arr[0])
puts str
puts arr.length

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

removing nodes from Nokogiri::XML::NodeSet Ted Flethuseo <flethuseo@gmail.com> - 2011-04-13 19:06 -0500
  Re: removing nodes from Nokogiri::XML::NodeSet Mike Dalessio <mike.dalessio@gmail.com> - 2011-04-13 22:02 -0500
    Re: removing nodes from Nokogiri::XML::NodeSet Ted Flethuseo <flethuseo@gmail.com> - 2011-04-14 08:31 -0500
      Re: removing nodes from Nokogiri::XML::NodeSet Robert Klemme <shortcutter@googlemail.com> - 2011-04-14 09:40 -0500
  Re: removing nodes from Nokogiri::XML::NodeSet 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-14 12:34 -0500

csiph-web