@@ -10525,7 +10525,7 @@ SELECT xpath_exists('/my:a/text()', '<my:a xmlns:my="http://example.com">test</m
10525
10525
</indexterm>
10526
10526
10527
10527
<synopsis>
10528
- <function>xmltable</function>( <optional>XMLNAMESPACES(<replaceable>namespace uri</replaceable> AS <replaceable>namespace name</replaceable><optional>, ...</optional>)</optional>
10528
+ <function>xmltable</function>( <optional>XMLNAMESPACES(<replaceable>namespace uri</replaceable> AS <replaceable>namespace name</replaceable><optional>, ...</optional>), </optional>
10529
10529
<replaceable>row_expression</replaceable> PASSING <optional>BY REF</optional> <replaceable>document_expression</replaceable> <optional>BY REF</optional>
10530
10530
COLUMNS <replaceable>name</replaceable> { <replaceable>type</replaceable> <optional>PATH <replaceable>column_expression</replaceable></optional> <optional>DEFAULT <replaceable>default_expression</replaceable></optional> <optional>NOT NULL | NULL</optional>
10531
10531
| FOR ORDINALITY }
@@ -10708,6 +10708,36 @@ SELECT xmltable.*
10708
10708
element
10709
10709
----------------------
10710
10710
Hello2a2 bbbCC
10711
+ ]]></screen>
10712
+ </para>
10713
+
10714
+ <para>
10715
+ The following example illustrates how
10716
+ the <literal>XMLNAMESPACES</literal> clause can be used to specify
10717
+ the default namespace, and a list of additional namespaces
10718
+ used in the XML document as well as in the XPath expressions:
10719
+
10720
+ <screen><![CDATA[
10721
+ WITH xmldata(data) AS (VALUES ('
10722
+ <example xmlns="http://example.com/myns" xmlns:B="http://example.com/b">
10723
+ <item foo="1" B:bar="2"/>
10724
+ <item foo="3" B:bar="4"/>
10725
+ <item foo="4" B:bar="5"/>
10726
+ </example>'::xml)
10727
+ )
10728
+ SELECT xmltable.*
10729
+ FROM XMLTABLE(XMLNAMESPACES('http://example.com/myns' AS x,
10730
+ 'http://example.com/b' AS "B"),
10731
+ '/x:example/x:item'
10732
+ PASSING (SELECT data FROM xmldata)
10733
+ COLUMNS foo int PATH '@foo',
10734
+ bar int PATH '@B:bar');
10735
+ foo | bar
10736
+ -----+-----
10737
+ 1 | 2
10738
+ 3 | 4
10739
+ 4 | 5
10740
+ (3 rows)
10711
10741
]]></screen>
10712
10742
</para>
10713
10743
</sect3>
0 commit comments