mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Add XMLText function (SQL/XML X038)
This function implements the standard XMLTest function, which converts text into xml text nodes. It uses the libxml2 function xmlEncodeSpecialChars to escape predefined entities (&"<>), so that those do not cause any conflict when concatenating the text node output with existing xml documents. This also adds a note in features.sgml about not supporting XML(SEQUENCE). The SQL specification defines a RETURNING clause to a set of XML functions, where RETURNING CONTENT or RETURNING SEQUENCE can be defined. Since PostgreSQL doesn't support XML(SEQUENCE) all of these functions operate with an implicit RETURNING CONTENT. Author: Jim Jones <jim.jones@uni-muenster.de> Reviewed-by: Vik Fearing <vik@postgresfriends.org> Discussion: https://postgr.es/m/86617a66-ec95-581f-8d54-08059cca8885@uni-muenster.de
This commit is contained in:
@ -199,6 +199,15 @@
|
||||
standard.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<productname>PostgreSQL</productname> does not support the
|
||||
<literal>RETURNING CONTENT</literal> or <literal>RETURNING SEQUENCE</literal>
|
||||
clauses, functions which are defined to have these in the specification
|
||||
are implicitly returning content.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
|
@ -14180,6 +14180,36 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
|
||||
documents for processing in client applications.
|
||||
</para>
|
||||
|
||||
<sect3 id="functions-producing-xml-xmltext">
|
||||
<title><literal>xmltext</literal></title>
|
||||
|
||||
<indexterm>
|
||||
<primary>xmltext</primary>
|
||||
</indexterm>
|
||||
|
||||
<synopsis>
|
||||
<function>xmltext</function> ( <type>text</type> ) <returnvalue>xml</returnvalue>
|
||||
</synopsis>
|
||||
|
||||
<para>
|
||||
The function <function>xmltext</function> returns an XML value with a single
|
||||
text node containing the input argument as its content. Predefined entities
|
||||
like ampersand (<literal><![CDATA[&]]></literal>), left and right angle brackets
|
||||
(<literal><![CDATA[< >]]></literal>), and quotation marks (<literal><![CDATA[""]]></literal>)
|
||||
are escaped.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Example:
|
||||
<screen><![CDATA[
|
||||
SELECT xmltext('< foo & bar >');
|
||||
xmltext
|
||||
-------------------------
|
||||
< foo & bar >
|
||||
]]></screen>
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 id="functions-producing-xml-xmlcomment">
|
||||
<title><literal>xmlcomment</literal></title>
|
||||
|
||||
|
Reference in New Issue
Block a user