Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "nokogiri"
- require "test/unit"
- class IbcNokogiriTest < Test::Unit::TestCase
- def test_XML_fragment_is_wrongly_parsed_when_contains_nodes_with_namespace_prefix_bug_192
- doc = Nokogiri::XML <<-EOXML
- <root xmlns="urn:root" xmlns:ns1="urn:ns1">
- </root>
- EOXML
- new_node = <<-EOXML
- <frag>
- <ns1:child_a />
- <ns1:child_b />
- </frag>
- EOXML
- frag = doc.root.fragment(new_node)
- puts "\n----- frag -----------------------------------"
- puts frag.to_xml
- puts "----------------------------------------------"
- doc.root.add_child(frag)
- puts "\n----- doc ------------------------------------"
- puts doc.to_xml
- puts "----------------------------------------------"
- assert_equal 1, doc.xpath('/*/*').size
- assert_equal 2, doc.xpath('/*/*/*').size
- assert_equal 0, doc.xpath('/*/*/*/*').size
- end
- end
Add Comment
Please, Sign In to add comment