P
pablitoman
let's say I have an xml document like this
<document>
<abcde>
<fghij>
some text blah blah
</fghij>
</abcde>
</document>
is there a simple method in nokogiri to:
step 1: convert all <fghij> tags to something else (e.g., <h1>)
creating this…
<document>
<abcde>
<h1>
some text blah blah
</h1>
</abcde>
</document>
step 2: remove all <abcde> tags but keep the internal tags, creating
this
<document>
<h1>
some text blah blah
</h1>
</document>
I imagine that step 2 is done all the time and there's probably a
simple way to do it, but I'm not sure where to begin with either.
file = Nokogiri::XML(File.new(file_name)) # <= this is about as far
as I've gotten (not very...)
Thanks!!
<document>
<abcde>
<fghij>
some text blah blah
</fghij>
</abcde>
</document>
is there a simple method in nokogiri to:
step 1: convert all <fghij> tags to something else (e.g., <h1>)
creating this…
<document>
<abcde>
<h1>
some text blah blah
</h1>
</abcde>
</document>
step 2: remove all <abcde> tags but keep the internal tags, creating
this
<document>
<h1>
some text blah blah
</h1>
</document>
I imagine that step 2 is done all the time and there's probably a
simple way to do it, but I'm not sure where to begin with either.
file = Nokogiri::XML(File.new(file_name)) # <= this is about as far
as I've gotten (not very...)
Thanks!!