From: Mike Dalessio Date: 2011-04-14T12:02:59+09:00 Subject: Re: removing nodes from Nokogiri::XML::NodeSet --000e0cd590d88d9e1904a0d8298f Content-Type: text/plain; charset=ISO-8859-1 Greetings, On Wed, Apr 13, 2011 at 8:06 PM, Ted Flethuseo wrote: > 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. > Nokogiri's NodeSet implements Enumerable, and much of the Array interface, so you should be able to treat it much like you'd treat any Ruby Array. For example, to remove the first node in a NodeSet, simply use `nodes.shift`. To remove the last node, use `nodes.pop`. Etc. > I have tried the following but it doesn't seem to work: > > puts nodes.length > nodes[0].remove > Just a note, that the above code removes the first node in the NodeSet from its document. Not what you want. Best of luck. --000e0cd590d88d9e1904a0d8298f--