Document more clearly on XML namespaces inside xpath function
Nikolay Samokhvalov
This commit is contained in:
parent
da254e3d16
commit
e6a7416e28
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.520 2010/06/29 22:29:13 momjian Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.521 2010/07/03 17:21:48 momjian Exp $ -->
|
||||||
|
|
||||||
<chapter id="functions">
|
<chapter id="functions">
|
||||||
<title>Functions and Operators</title>
|
<title>Functions and Operators</title>
|
||||||
@ -8610,8 +8610,11 @@ SELECT xmlagg(x) FROM (SELECT * FROM test ORDER BY y DESC) AS tab;
|
|||||||
mappings. This array should be a two-dimensional array with the
|
mappings. This array should be a two-dimensional array with the
|
||||||
length of the second axis being equal to 2 (i.e., it should be an
|
length of the second axis being equal to 2 (i.e., it should be an
|
||||||
array of arrays, each of which consists of exactly 2 elements).
|
array of arrays, each of which consists of exactly 2 elements).
|
||||||
The first element of each array entry is the namespace name, the
|
The first element of each array entry is the namespace name (alias), the
|
||||||
second the namespace URI.
|
second the namespace URI. It is not required that aliases provided in
|
||||||
|
this array are the same that those being used in the XML document itself (in
|
||||||
|
other words, both in the XML document and in the <function>xpath</function>
|
||||||
|
function context, aliases are <emphasis>local</>).
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -8624,6 +8627,19 @@ SELECT xpath('/my:a/text()', '<my:a xmlns:my="http://example.com">test</my:a>',
|
|||||||
--------
|
--------
|
||||||
{test}
|
{test}
|
||||||
(1 row)
|
(1 row)
|
||||||
|
]]></screen>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
How to deal with default (anonymous) namespaces:
|
||||||
|
<screen><![CDATA[
|
||||||
|
SELECT xpath('//mydefns:b/text()', '<a xmlns="http://example.com"><b>test</b></a>',
|
||||||
|
ARRAY[ARRAY['mydefns', 'http://example.com']]);
|
||||||
|
|
||||||
|
xpath
|
||||||
|
--------
|
||||||
|
{test}
|
||||||
|
(1 row)
|
||||||
]]></screen>
|
]]></screen>
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user