search for: add_next_sibling

Displaying 1 result from an estimated 1 matches for "add_next_sibling".

2011 Feb 20
7
Using Nokogiri to insert a <span> tag into existing text
...s before index X 2) Adding the <span> as a next sibling to the original node 3) Adding another next sibling to the original node that is another text node, whose contents are the rest of the text in the original node. I can pass a string with "<span>blah</span>" to Node#add_next_sibling handle #2. I''m having trouble with creating a new text node and passing it to Node#add_next_sibling though. 1) Does anyone have an example of creating a new text node in Nokogiri? 2) Is there a simpler way to do this than splitting up one text node into 3 nodes? Many thanks, Wes -- P...