From fa46252e326ab16b8921fe8b7f09dace1b9d8ea7 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 16 Nov 2016 17:46:14 -0300 Subject: [PATCH 1/2] Create in the functions-xml section This is so that a new XMLTABLE sect3 can be added nicely later. Author: Craig Ringer --- doc/src/sgml/func.sgml | 104 ++++++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index eca98df..43db430 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -10325,10 +10325,6 @@ SELECT xml_is_well_formed_document(' Processing XML - - XPath - - To process values of data type xml, PostgreSQL offers the functions xpath and @@ -10336,39 +10332,46 @@ SELECT xml_is_well_formed_document(' + <literal>xpath</literal> + + + XPath + + xpath(xpath, xml , nsarray) - - The function xpath evaluates the XPath - expression xpath (a text value) - against the XML value - xml. It returns an array of XML values - corresponding to the node set produced by the XPath expression. - If the XPath expression returns a scalar value rather than a node set, - a single-element array is returned. - + + The function xpath evaluates the XPath + expression xpath (a text value) + against the XML value + xml. It returns an array of XML values + corresponding to the node set produced by the XPath expression. + If the XPath expression returns a scalar value rather than a node set, + a single-element array is returned. + - - The second argument must be a well formed XML document. In particular, - it must have a single root node element. - + + The second argument must be a well formed XML document. In particular, + it must have a single root node element. + - - The optional third argument of the function is an array of namespace - mappings. This array should be a two-dimensional text array with - the 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). - The first element of each array entry is the namespace name (alias), the - second the namespace URI. It is not required that aliases provided in - this array be the same as those being used in the XML document itself (in - other words, both in the XML document and in the xpath - function context, aliases are local). - + + The optional third argument of the function is an array of namespace + mappings. This array should be a two-dimensional text array with + the 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). + The first element of each array entry is the namespace name (alias), the + second the namespace URI. It is not required that aliases provided in + this array be the same as those being used in the XML document itself (in + other words, both in the XML document and in the xpath + function context, aliases are local). + - - Example: + + Example: test', ARRAY[ARRAY['my', 'http://example.com']]); @@ -10378,10 +10381,10 @@ SELECT xpath('/my:a/text()', 'test', {test} (1 row) ]]> - + - - To deal with default (anonymous) namespaces, do something like this: + + To deal with default (anonymous) namespaces, do something like this: test', ARRAY[ARRAY['mydefns', 'http://example.com']]); @@ -10391,27 +10394,31 @@ SELECT xpath('//mydefns:b/text()', 'test - + + - - xpath_exists - + + <literal>xpath_exists</literal> + + + xpath_exists + xpath_exists(xpath, xml , nsarray) - - The function xpath_exists is a specialized form - of the xpath function. Instead of returning the - individual XML values that satisfy the XPath, this function returns a - Boolean indicating whether the query was satisfied or not. This - function is equivalent to the standard XMLEXISTS predicate, - except that it also offers support for a namespace mapping argument. - + + The function xpath_exists is a specialized form + of the xpath function. Instead of returning the + individual XML values that satisfy the XPath, this function returns a + Boolean indicating whether the query was satisfied or not. This + function is equivalent to the standard XMLEXISTS predicate, + except that it also offers support for a namespace mapping argument. + - - Example: + + Example: test', ARRAY[ARRAY['my', 'http://example.com']]); @@ -10421,7 +10428,8 @@ SELECT xpath_exists('/my:a/text()', 'test - + + -- 2.1.4