Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env ruby
# see
require 'nokogiri'
src =<<EOD
<wrapper xmlns="ns">
<record xml:id="r1" xmlns:extra="extra">
<field extra:type="second">bbb</field>
src_doc = Nokogiri::XML(src)
record ='//base:record', {'base' => "ns"})
puts "== Original document"
puts src_doc.to_xml
# we need record.dup to see a second record below
puts "== New document"
puts "== Where is my second record?!!"
puts src_doc.to_xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.