I'm trying to find the correct way to serialize the nodes returned in a node list via an XPath evaluation and preserving the namespaces of the source document. My problem originates in the XML support in PostgresSQL (http://archives.postgresql.org//pgsql-bugs/2008-06/msg00124.php) which shows a small test case... but in effect if I have a document like
<a:foo xmlns:a="a:urn"> <a:bar x="y">bar1</a:bar> <a:bar x="y">bar2</a:bar> </a:foo> and I evaluate the XPath /a:foo/a:bar[1] (with the "a:urn" namespace mapping registered) to get a single node <a:bar x="y">bar1</a:bar> I want to then be able to evaluate another XPath on that node like /a:bar/@x and get a matching attribute @x. This second XPath evaluation is what is not working... but it _does_ work if no namespaces are present in the source document. In the context of how PostgreSQL is using libxml, after the first XPath evaluation it is serializing the results by calling xmlNodeDump() on each node returned in the node list returned by the XPath evaluation. And xmlNodeDump() is returning the string literal <a:bar x="y">bar1</a:bar> which does not have the "a:urn" namespace declaration as one might expect (at least, for a document), e.g. <a:bar xmlns:a="a:urn" x="y">bar1</a:bar> Is there a way for xmlNodeDump(), or some other function, to serialize a node such as this one in this latter way rather than the former? Regards, m@ _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
