On PostgreSQL 9.1 i can execute this two queries with out any errors, with correct result:
SELECT xpath('/a', '<a s:dd="11"><c>test</c></a>')
SELECT xpath('/a', '<a s:dd="11"><c>test</c></a>',ARRAY[ARRAY['s', 'http://example.com']])
On PostgreSQL 9.2 same queries throws error:
ERROR: could not parse XML document
DETAIL: line 1: Namespace prefix s for dd on a is not defined
Only this query works fine:
SELECT xpath('/a', '<a xmlns:s="ddd" s:dd="11"><c>test</c></a>')
How can i parse XML file, whth out modifying XML code?
Problems starts when i want to make xpath query for xml element, recived from previous query.
For example xml document:
<some xmlns:my="somens">
<a>
<b my:param="11" />
</a>
</some>
And i want to do something like this:
elem = xpath('/a',doc);
elem2= xpath('//b',elem[0]);
And second row throws error, becouse of unknown prefix my. Any ideas?