From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | proposal - Default namespaces for XPath expressions (PostgreSQL 11) |
Date: | 2017-03-11 19:44:31 |
Message-ID: | CAFj8pRB+WDyDcZyGmfRdJ0HOoXugeaL-KNFeK9YA5Z10JN9qfA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi
This proposal is followup of implementation of XMLTABLE.
Lot of XML documents has assigned document namespace.
<rows xmlns="http://x.y"><row><a>10</a></row></rows>
For these XML document any search path must use schema "http://x.y". This
is not too intuitive, and from XMLTABLE usage is not too user friendly,
because the default column path (same like column name) cannot be used. A
solution of this issue is default namespace - defined in SQL/XML.
example - related to previous xml
without default namespace:
XMLTABLE(NAMESPACES('http://x.y' AS aux),
'/aux:rows/aux:row' PASSING ...
COLUMNS a int PATH 'aux:a')
with default namespace
XMLTABLE(NAMESPACES(DEFAULT 'http://x.y'),
'/rows/row' PASSING ...
COLUMNS a int);
Unfortunately the libxml2 doesn't support default namespaces in XPath
expressions. Because the libxml2 functionality is frozen, there is not big
chance for support in near future. A implementation is not too hard -
although it requires simple XPath expressions state translator.
The databases with XMLTABLE implementation supports default namespace for
XPath expressions.
The patch for initial implementation is attached.
Regards
Pavel
Attachment | Content-Type | Size |
---|---|---|
xml-xpath-default-ns.patch | text/x-patch | 12.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2017-03-11 19:48:31 | Re: Need a builtin way to run all tests faster manner |
Previous Message | Jim Nasby | 2017-03-11 19:19:35 | Re: Need a builtin way to run all tests faster manner |