Consider these two XML documents:
a.xml
<a xmlns="foo" xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="b.xml" parse="xml" />
</a>
b.xml
<b>Hi Mom!</b>
What namespace should the <b>
element be in after inclusion, foo
or no namespace?
Using Nokogiri to load the first document with XInclude processing produces a text representation that would imply that <b>
is in the parent namespace, but inspecting the elements claims that <b>
has no namespace:
require 'nokogiri'
d = Nokogiri.XML(IO.read('a.xml'),&:xinclude)
puts d
#=> <?xml version="1.0"?>
#=> <a xmlns="foo" xmlns:xi="http://www.w3.org/2001/XInclude">
#=> <b>Hi Mom!</b>
#=> </a>
p d.root.namespace
#=> #<Nokogiri::XML::Namespace:0x3fd40c517de8 href="foo">
p d.root.elements.first.namespace
#=> nil