Namespace for XInclude included elements

Fethi.dz

New Member
Consider these two XML documents:a.xml\[code\]<a xmlns="foo" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="http://stackoverflow.com/questions/14542030/b.xml" parse="xml" /></a>\[/code\]b.xml\[code\]<b>Hi Mom!</b>\[/code\]What namespace should the \[code\]<b>\[/code\] element be in after inclusion, \[code\]foo\[/code\] or no namespace?Using Nokogiri to load the first document with XInclude processing produces a text representation that would imply that \[code\]<b>\[/code\] is in the parent namespace, but inspecting the elements claims that \[code\]<b>\[/code\] has no namespace:\[code\]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="http://stackoverflow.com/questions/14542030/foo">p d.root.elements.first.namespace#=> nil\[/code\]
 
Back
Top