File tree Expand file tree Collapse file tree 5 files changed +25
-11
lines changed Expand file tree Collapse file tree 5 files changed +25
-11
lines changed Original file line number Diff line number Diff line change @@ -21,17 +21,24 @@ you can place it in a different directory in a PostgreSQL tree).
21
21
Before you begin, just check the Makefile, and then just 'make' and
22
22
'make install'.
23
23
24
- This code requires libxml to be previously installed.
24
+ By default, this module requires both libxml2 and libxslt to be installed
25
+ on your system. If you do not have libxslt or do not want to use XSLT
26
+ functions, you must edit the Makefile to not build the XSLT functions,
27
+ as directed in its comments; and edit pgxml.sql.in to remove the XSLT
28
+ function declarations, as directed in its comments.
25
29
26
30
Description of functions
27
31
------------------------
28
32
29
33
The first set of functions are straightforward XML parsing and XPath queries:
30
34
31
- xml_valid (document) RETURNS bool
35
+ xml_is_well_formed (document) RETURNS bool
32
36
33
37
This parses the document text in its parameter and returns true if the
34
- document is well-formed XML.
38
+ document is well-formed XML. (Note: before PostgreSQL 8.2, this function
39
+ was called xml_valid(). That is the wrong name since validity and
40
+ well-formedness have different meanings in XML. The old name is still
41
+ available, but is deprecated and will be removed in 8.3.)
35
42
36
43
xpath_string(document,query) RETURNS text
37
44
xpath_number(document,query) RETURNS float4
Original file line number Diff line number Diff line change 1
1
--SQL for XML parser
2
2
3
- CREATE OR REPLACE FUNCTION xml_valid (text) RETURNS bool
3
+ CREATE OR REPLACE FUNCTION xml_is_well_formed (text) RETURNS bool
4
4
AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE;
5
5
6
+ -- deprecated old name for xml_is_well_formed
7
+ CREATE OR REPLACE FUNCTION xml_valid(text) RETURNS bool
8
+ AS 'MODULE_PATHNAME', 'xml_is_well_formed' LANGUAGE C STRICT IMMUTABLE;
9
+
6
10
CREATE OR REPLACE FUNCTION xml_encode_special_chars(text) RETURNS text
7
11
AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE;
8
12
Original file line number Diff line number Diff line change @@ -24,4 +24,7 @@ DROP FUNCTION xpath_string(text,text);
24
24
25
25
DROP FUNCTION xml_encode_special_chars(text );
26
26
27
+ -- deprecated old name for xml_is_well_formed
27
28
DROP FUNCTION xml_valid(text );
29
+
30
+ DROP FUNCTION xml_is_well_formed(text );
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ xmlChar *pgxml_texttoxmlchar(text *textstring);
42
42
static xmlXPathObjectPtr pgxml_xpath (text * document , xmlChar * xpath );
43
43
44
44
45
- Datum xml_valid (PG_FUNCTION_ARGS );
45
+ Datum xml_is_well_formed (PG_FUNCTION_ARGS );
46
46
Datum xml_encode_special_chars (PG_FUNCTION_ARGS );
47
47
Datum xpath_nodeset (PG_FUNCTION_ARGS );
48
48
Datum xpath_string (PG_FUNCTION_ARGS );
@@ -166,12 +166,12 @@ pgxml_parser_init()
166
166
167
167
/* Returns true if document is well-formed */
168
168
169
- PG_FUNCTION_INFO_V1 (xml_valid );
169
+ PG_FUNCTION_INFO_V1 (xml_is_well_formed );
170
170
171
171
Datum
172
- xml_valid (PG_FUNCTION_ARGS )
172
+ xml_is_well_formed (PG_FUNCTION_ARGS )
173
173
{
174
- /* called as xml_valid (document) */
174
+ /* called as xml_is_well_formed (document) */
175
175
xmlDocPtr doctree ;
176
176
text * t = PG_GETARG_TEXT_P (0 ); /* document buffer */
177
177
int32 docsize = VARSIZE (t ) - VARHDRSZ ;
Original file line number Diff line number Diff line change 1
- <!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.174 2006/09/16 00:30:12 momjian Exp $ -->
1
+ <!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.175 2006/09/16 16:18:11 tgl Exp $ -->
2
2
3
3
<chapter id="datatype">
4
4
<title id="datatype-title">Data Types</title>
@@ -3345,8 +3345,8 @@ SELECT * FROM pg_attribute
3345
3345
3346
3346
<para>
3347
3347
<filename>/contrib/xml2</> has a function called
3348
- <function>xml_valid ()</> that can be used in a <literal>CHECK</>
3349
- constraint to enforce that a field contains valid <acronym>XML</>.
3348
+ <function>xml_is_well_formed ()</> that can be used in a <literal>CHECK</>
3349
+ constraint to enforce that a field contains well-formed <acronym>XML</>.
3350
3350
It does not support validation against a specific <acronym>XML</>
3351
3351
schema. A server-side language with <acronym>XML</> capabilities
3352
3352
could be used to do schema-specific <acronym>XML</> checks.
You can’t perform that action at this time.
0 commit comments