PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
xml.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * xml.h
4  * Declarations for XML data type support.
5  *
6  *
7  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/utils/xml.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 
15 #ifndef XML_H
16 #define XML_H
17 
18 #include "fmgr.h"
19 #include "nodes/execnodes.h"
20 #include "nodes/primnodes.h"
21 
22 typedef struct varlena xmltype;
23 
24 typedef enum
25 {
31 
32 typedef enum
33 {
37 
38 typedef enum
39 {
40  PG_XML_STRICTNESS_LEGACY, /* ignore errors unless function result
41  * indicates error condition */
42  PG_XML_STRICTNESS_WELLFORMED, /* ignore non-parser messages */
43  PG_XML_STRICTNESS_ALL /* report all notices/warnings/errors */
45 
46 /* struct PgXmlErrorContext is private to xml.c */
48 
49 #define DatumGetXmlP(X) ((xmltype *) PG_DETOAST_DATUM(X))
50 #define XmlPGetDatum(X) PointerGetDatum(X)
51 
52 #define PG_GETARG_XML_P(n) DatumGetXmlP(PG_GETARG_DATUM(n))
53 #define PG_RETURN_XML_P(x) PG_RETURN_POINTER(x)
54 
70 
79 
83 
87 
88 extern void pg_xml_init_library(void);
90 extern void pg_xml_done(PgXmlErrorContext *errcxt, bool isError);
91 extern bool pg_xml_error_occurred(PgXmlErrorContext *errcxt);
92 extern void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode,
93  const char *msg);
94 
95 extern xmltype *xmlconcat(List *args);
96 extern xmltype *xmlelement(XmlExprState *xmlExpr, ExprContext *econtext);
97 extern xmltype *xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace);
98 extern xmltype *xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null);
99 extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
100 extern bool xml_is_document(xmltype *arg);
101 extern text *xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg);
102 extern char *escape_xml(const char *str);
103 
104 extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, bool escape_period);
105 extern char *map_xml_name_to_sql_identifier(char *name);
106 extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings);
107 
108 extern int xmlbinary; /* XmlBinaryType, but int for guc enum */
109 
110 extern int xmloption; /* XmlOptionType, but int for guc enum */
111 
112 #endif /* XML_H */
static struct @76 value
xmltype * xmlelement(XmlExprState *xmlExpr, ExprContext *econtext)
Definition: xml.c:577
XmlBinaryType
Definition: xml.h:32
xmltype * xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null)
Definition: xml.c:719
Datum xmlvalidate(PG_FUNCTION_ARGS)
Definition: xml.c:827
Datum xml_is_well_formed_document(PG_FUNCTION_ARGS)
Definition: xml.c:4052
xmltype * xmlconcat(List *args)
Definition: xml.c:461
Datum xml_is_well_formed(PG_FUNCTION_ARGS)
Definition: xpath.c:96
bool pg_xml_error_occurred(PgXmlErrorContext *errcxt)
struct PgXmlErrorContext PgXmlErrorContext
Definition: xml.h:47
Datum schema_to_xml(PG_FUNCTION_ARGS)
Definition: xml.c:2673
Datum xml_recv(PG_FUNCTION_ARGS)
Definition: xml.c:300
unsigned int Oid
Definition: postgres_ext.h:31
bool xml_is_document(xmltype *arg)
Definition: xml.c:837
Datum xmlconcat2(PG_FUNCTION_ARGS)
Definition: xml.c:527
Datum texttoxml(PG_FUNCTION_ARGS)
Definition: xml.c:545
Datum xpath_exists(PG_FUNCTION_ARGS)
Definition: xml.c:3989
Datum database_to_xml(PG_FUNCTION_ARGS)
Definition: xml.c:2851
char * map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings)
Definition: xml.c:1953
Datum cursor_to_xml(PG_FUNCTION_ARGS)
Definition: xml.c:2372
Datum schema_to_xml_and_xmlschema(PG_FUNCTION_ARGS)
Definition: xml.c:2777
void pg_xml_init_library(void)
xmltype * xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace)
Definition: xml.c:701
Datum xmlexists(PG_FUNCTION_ARGS)
Definition: xml.c:3966
Datum query_to_xml_and_xmlschema(PG_FUNCTION_ARGS)
Definition: xml.c:2591
void pg_xml_done(PgXmlErrorContext *errcxt, bool isError)
Datum table_to_xml(PG_FUNCTION_ARGS)
Definition: xml.c:2344
Datum database_to_xmlschema(PG_FUNCTION_ARGS)
Definition: xml.c:2906
Datum xmltotext(PG_FUNCTION_ARGS)
Definition: xml.c:554
Datum xml_send(PG_FUNCTION_ARGS)
Definition: xml.c:367
XmlStandaloneType
Definition: xml.h:24
Datum query_to_xml(PG_FUNCTION_ARGS)
Definition: xml.c:2358
uintptr_t Datum
Definition: postgres.h:374
Datum database_to_xml_and_xmlschema(PG_FUNCTION_ARGS)
Definition: xml.c:2918
text * xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg)
Definition: xml.c:564
char * map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, bool escape_period)
Definition: xml.c:1837
Datum xpath(PG_FUNCTION_ARGS)
Definition: xml.c:3943
int xmlbinary
Definition: xml.c:95
Datum xml_out(PG_FUNCTION_ARGS)
Definition: xml.c:285
int xmloption
Definition: xml.c:96
Datum xml_is_well_formed_content(PG_FUNCTION_ARGS)
Definition: xml.c:4065
xmltype * xmlroot(xmltype *data, text *version, int standalone)
Definition: xml.c:771
XmlOptionType
Definition: primnodes.h:1067
Datum xmlcomment(PG_FUNCTION_ARGS)
Definition: xml.c:420
Datum xml_in(PG_FUNCTION_ARGS)
Definition: xml.c:207
char * escape_xml(const char *str)
Definition: xml.c:2172
const char * name
Definition: encode.c:521
Datum table_to_xmlschema(PG_FUNCTION_ARGS)
Definition: xml.c:2496
Datum schema_to_xmlschema(PG_FUNCTION_ARGS)
Definition: xml.c:2764
void * arg
char * map_xml_name_to_sql_identifier(char *name)
Definition: xml.c:1913
Definition: c.h:434
#define PG_FUNCTION_ARGS
Definition: fmgr.h:150
Datum cursor_to_xmlschema(PG_FUNCTION_ARGS)
Definition: xml.c:2544
Definition: pg_list.h:45
PgXmlStrictness
Definition: xml.h:38
Datum table_to_xml_and_xmlschema(PG_FUNCTION_ARGS)
Definition: xml.c:2570
PgXmlErrorContext * pg_xml_init(PgXmlStrictness strictness)
Datum query_to_xmlschema(PG_FUNCTION_ARGS)
Definition: xml.c:2515
void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode, const char *msg)