[libxml-devel] Node#inner_xml() with all namespaces declared?

Tim Olsen tolsen at limelabs.com
Wed Aug 19 11:10:20 EDT 2009


Hello,

I am trying to call Node#inner_xml() and have all namespaces referenced
in the inner xml be spit out as well, so that the returned string can be
parsed again.

For example, take the following xml:

<a:feed xmlns:a="http://www.w3.org/2005/Atom">
  <a:title a:type="text">Phil Bogle's Contacts</a:title>
</a:feed>

I would like to be able to call inner_xml() on the feed node, and get:

<a:title a:type="text" xmlns:a="http://www.w3.org/2005/Atom">Phil
Bogle's Contacts</a:title>

Notice the namespace declaration now on the title node.

I couldn't find an option to pass to inner_xml() (or to_s()) to do this.
 I was thinking maybe I could modify what Namespaces#definitions()
returns but I couldn't find a method to modify the definitions.

Any idea how to achieve this?

Thanks,
Tim


More information about the libxml-devel mailing list