Skip to content

Commit e6a7416

Browse files
committed
Document more clearly on XML namespaces inside xpath function
Nikolay Samokhvalov
1 parent da254e3 commit e6a7416

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

doc/src/sgml/func.sgml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.520 2010/06/29 22:29:13 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.521 2010/07/03 17:21:48 momjian Exp $ -->
22

33
<chapter id="functions">
44
<title>Functions and Operators</title>
@@ -8610,8 +8610,11 @@ SELECT xmlagg(x) FROM (SELECT * FROM test ORDER BY y DESC) AS tab;
86108610
mappings. This array should be a two-dimensional array with the
86118611
length of the second axis being equal to 2 (i.e., it should be an
86128612
array of arrays, each of which consists of exactly 2 elements).
8613-
The first element of each array entry is the namespace name, the
8614-
second the namespace URI.
8613+
The first element of each array entry is the namespace name (alias), the
8614+
second the namespace URI. It is not required that aliases provided in
8615+
this array are the same that those being used in the XML document itself (in
8616+
other words, both in the XML document and in the <function>xpath</function>
8617+
function context, aliases are <emphasis>local</>).
86158618
</para>
86168619

86178620
<para>
@@ -8624,6 +8627,19 @@ SELECT xpath('/my:a/text()', '<my:a xmlns:my="http://example.com">test</my:a>',
86248627
--------
86258628
{test}
86268629
(1 row)
8630+
]]></screen>
8631+
</para>
8632+
8633+
<para>
8634+
How to deal with default (anonymous) namespaces:
8635+
<screen><![CDATA[
8636+
SELECT xpath('//mydefns:b/text()', '<a xmlns="http://example.com"><b>test</b></a>',
8637+
ARRAY[ARRAY['mydefns', 'http://example.com']]);
8638+
8639+
xpath
8640+
--------
8641+
{test}
8642+
(1 row)
86278643
]]></screen>
86288644
</para>
86298645
</sect2>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy