mirror of
https://github.com/postgres/postgres.git
synced 2025-10-21 02:52:47 +03:00
Don't use SGML empty tags
For DocBook XML compatibility, don't use SGML empty tags (</>) anymore, replace by the full tag name. Add a warning option to catch future occurrences. Alexander Lakhin, Jürgen Purtz
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
</indexterm>
|
||||
|
||||
<para>
|
||||
The <filename>xml2</> module provides XPath querying and
|
||||
The <filename>xml2</filename> module provides XPath querying and
|
||||
XSLT functionality.
|
||||
</para>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<title>Deprecation Notice</title>
|
||||
|
||||
<para>
|
||||
From <productname>PostgreSQL</> 8.3 on, there is XML-related
|
||||
From <productname>PostgreSQL</productname> 8.3 on, there is XML-related
|
||||
functionality based on the SQL/XML standard in the core server.
|
||||
That functionality covers XML syntax checking and XPath queries,
|
||||
which is what this module does, and more, but the API is
|
||||
@@ -36,7 +36,7 @@
|
||||
<para>
|
||||
<xref linkend="xml2-functions-table"> shows the functions provided by this module.
|
||||
These functions provide straightforward XML parsing and XPath queries.
|
||||
All arguments are of type <type>text</>, so for brevity that is not shown.
|
||||
All arguments are of type <type>text</type>, so for brevity that is not shown.
|
||||
</para>
|
||||
|
||||
<table id="xml2-functions-table">
|
||||
@@ -63,8 +63,8 @@
|
||||
<para>
|
||||
This parses the document text in its parameter and returns true if the
|
||||
document is well-formed XML. (Note: this is an alias for the standard
|
||||
PostgreSQL function <function>xml_is_well_formed()</>. The
|
||||
name <function>xml_valid()</> is technically incorrect since validity
|
||||
PostgreSQL function <function>xml_is_well_formed()</function>. The
|
||||
name <function>xml_valid()</function> is technically incorrect since validity
|
||||
and well-formedness have different meanings in XML.)
|
||||
</para>
|
||||
</entry>
|
||||
@@ -124,7 +124,7 @@
|
||||
<itemtag>Value 2....</itemtag>
|
||||
</toptag>
|
||||
</synopsis>
|
||||
If either <literal>toptag</> or <literal>itemtag</> is an empty string, the relevant tag is omitted.
|
||||
If either <literal>toptag</literal> or <literal>itemtag</literal> is an empty string, the relevant tag is omitted.
|
||||
</para>
|
||||
</entry>
|
||||
</row>
|
||||
@@ -139,7 +139,7 @@
|
||||
</entry>
|
||||
<entry>
|
||||
<para>
|
||||
Like <function>xpath_nodeset(document, query, toptag, itemtag)</> but result omits both tags.
|
||||
Like <function>xpath_nodeset(document, query, toptag, itemtag)</function> but result omits both tags.
|
||||
</para>
|
||||
</entry>
|
||||
</row>
|
||||
@@ -154,7 +154,7 @@
|
||||
</entry>
|
||||
<entry>
|
||||
<para>
|
||||
Like <function>xpath_nodeset(document, query, toptag, itemtag)</> but result omits <literal>toptag</literal>.
|
||||
Like <function>xpath_nodeset(document, query, toptag, itemtag)</function> but result omits <literal>toptag</literal>.
|
||||
</para>
|
||||
</entry>
|
||||
</row>
|
||||
@@ -170,8 +170,8 @@
|
||||
<entry>
|
||||
<para>
|
||||
This function returns multiple values separated by the specified
|
||||
separator, for example <literal>Value 1,Value 2,Value 3</> if
|
||||
separator is <literal>,</>.
|
||||
separator, for example <literal>Value 1,Value 2,Value 3</literal> if
|
||||
separator is <literal>,</literal>.
|
||||
</para>
|
||||
</entry>
|
||||
</row>
|
||||
@@ -185,7 +185,7 @@
|
||||
<type>text</type>
|
||||
</entry>
|
||||
<entry>
|
||||
This is a wrapper for the above function that uses <literal>,</>
|
||||
This is a wrapper for the above function that uses <literal>,</literal>
|
||||
as the separator.
|
||||
</entry>
|
||||
</row>
|
||||
@@ -206,7 +206,7 @@ xpath_table(text key, text document, text relation, text xpaths, text criteria)
|
||||
</synopsis>
|
||||
|
||||
<para>
|
||||
<function>xpath_table</> is a table function that evaluates a set of XPath
|
||||
<function>xpath_table</function> is a table function that evaluates a set of XPath
|
||||
queries on each of a set of documents and returns the results as a
|
||||
table. The primary key field from the original document table is returned
|
||||
as the first column of the result so that the result set
|
||||
@@ -228,7 +228,7 @@ xpath_table(text key, text document, text relation, text xpaths, text criteria)
|
||||
<entry><parameter>key</parameter></entry>
|
||||
<entry>
|
||||
<para>
|
||||
the name of the <quote>key</> field — this is just a field to be used as
|
||||
the name of the <quote>key</quote> field — this is just a field to be used as
|
||||
the first column of the output table, i.e., it identifies the record from
|
||||
which each output row came (see note below about multiple values)
|
||||
</para>
|
||||
@@ -285,7 +285,7 @@ xpath_table(text key, text document, text relation, text xpaths, text criteria)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
so those parameters can be <emphasis>anything</> valid in those particular
|
||||
so those parameters can be <emphasis>anything</emphasis> valid in those particular
|
||||
locations. The result from this SELECT needs to return exactly two
|
||||
columns (which it will unless you try to list multiple fields for key
|
||||
or document). Beware that this simplistic approach requires that you
|
||||
@@ -293,8 +293,8 @@ xpath_table(text key, text document, text relation, text xpaths, text criteria)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The function has to be used in a <literal>FROM</> expression, with an
|
||||
<literal>AS</> clause to specify the output columns; for example
|
||||
The function has to be used in a <literal>FROM</literal> expression, with an
|
||||
<literal>AS</literal> clause to specify the output columns; for example
|
||||
<programlisting>
|
||||
SELECT * FROM
|
||||
xpath_table('article_id',
|
||||
@@ -304,8 +304,8 @@ xpath_table('article_id',
|
||||
'date_entered > ''2003-01-01'' ')
|
||||
AS t(article_id integer, author text, page_count integer, title text);
|
||||
</programlisting>
|
||||
The <literal>AS</> clause defines the names and types of the columns in the
|
||||
output table. The first is the <quote>key</> field and the rest correspond
|
||||
The <literal>AS</literal> clause defines the names and types of the columns in the
|
||||
output table. The first is the <quote>key</quote> field and the rest correspond
|
||||
to the XPath queries.
|
||||
If there are more XPath queries than result columns,
|
||||
the extra queries will be ignored. If there are more result columns
|
||||
@@ -313,19 +313,19 @@ AS t(article_id integer, author text, page_count integer, title text);
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Notice that this example defines the <structname>page_count</> result
|
||||
Notice that this example defines the <structname>page_count</structname> result
|
||||
column as an integer. The function deals internally with string
|
||||
representations, so when you say you want an integer in the output, it will
|
||||
take the string representation of the XPath result and use PostgreSQL input
|
||||
functions to transform it into an integer (or whatever type the <type>AS</>
|
||||
functions to transform it into an integer (or whatever type the <type>AS</type>
|
||||
clause requests). An error will result if it can't do this — for
|
||||
example if the result is empty — so you may wish to just stick to
|
||||
<type>text</> as the column type if you think your data has any problems.
|
||||
<type>text</type> as the column type if you think your data has any problems.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The calling <command>SELECT</> statement doesn't necessarily have to be
|
||||
just <literal>SELECT *</> — it can reference the output
|
||||
The calling <command>SELECT</command> statement doesn't necessarily have to be
|
||||
just <literal>SELECT *</literal> — it can reference the output
|
||||
columns by name or join them to other tables. The function produces a
|
||||
virtual table with which you can perform any operation you wish (e.g.
|
||||
aggregation, joining, sorting etc). So we could also have:
|
||||
@@ -346,7 +346,7 @@ WHERE t.author_id = p.person_id;
|
||||
<title>Multivalued Results</title>
|
||||
|
||||
<para>
|
||||
The <function>xpath_table</> function assumes that the results of each XPath query
|
||||
The <function>xpath_table</function> function assumes that the results of each XPath query
|
||||
might be multivalued, so the number of rows returned by the function
|
||||
may not be the same as the number of input documents. The first row
|
||||
returned contains the first result from each query, the second row the
|
||||
@@ -393,8 +393,8 @@ WHERE id = 1 ORDER BY doc_num, line_num
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To get <literal>doc_num</> on every line, the solution is to use two invocations
|
||||
of <function>xpath_table</> and join the results:
|
||||
To get <literal>doc_num</literal> on every line, the solution is to use two invocations
|
||||
of <function>xpath_table</function> and join the results:
|
||||
|
||||
<programlisting>
|
||||
SELECT t.*,i.doc_num FROM
|
||||
@@ -437,15 +437,15 @@ xslt_process(text document, text stylesheet, text paramlist) returns text
|
||||
|
||||
<para>
|
||||
This function applies the XSL stylesheet to the document and returns
|
||||
the transformed result. The <literal>paramlist</> is a list of parameter
|
||||
the transformed result. The <literal>paramlist</literal> is a list of parameter
|
||||
assignments to be used in the transformation, specified in the form
|
||||
<literal>a=1,b=2</>. Note that the
|
||||
<literal>a=1,b=2</literal>. Note that the
|
||||
parameter parsing is very simple-minded: parameter values cannot
|
||||
contain commas!
|
||||
</para>
|
||||
|
||||
<para>
|
||||
There is also a two-parameter version of <function>xslt_process</> which
|
||||
There is also a two-parameter version of <function>xslt_process</function> which
|
||||
does not pass any parameters to the transformation.
|
||||
</para>
|
||||
</sect3>
|
||||
|
Reference in New Issue
Block a user