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-2017, 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 
55 extern void pg_xml_init_library(void);
57 extern void pg_xml_done(PgXmlErrorContext *errcxt, bool isError);
58 extern bool pg_xml_error_occurred(PgXmlErrorContext *errcxt);
59 extern void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode,
60  const char *msg);
61 
62 extern xmltype *xmlconcat(List *args);
63 extern xmltype *xmlelement(XmlExprState *xmlExpr, ExprContext *econtext);
64 extern xmltype *xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace);
65 extern xmltype *xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null);
66 extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
67 extern bool xml_is_document(xmltype *arg);
68 extern text *xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg);
69 extern char *escape_xml(const char *str);
70 
71 extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, bool escape_period);
72 extern char *map_xml_name_to_sql_identifier(char *name);
73 extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings);
74 
75 extern int xmlbinary; /* XmlBinaryType, but int for guc enum */
76 
77 extern int xmloption; /* XmlOptionType, but int for guc enum */
78 
79 #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
xmltype * xmlconcat(List *args)
Definition: xml.c:461
bool pg_xml_error_occurred(PgXmlErrorContext *errcxt)
struct PgXmlErrorContext PgXmlErrorContext
Definition: xml.h:47
unsigned int Oid
Definition: postgres_ext.h:31
bool xml_is_document(xmltype *arg)
Definition: xml.c:837
char * map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings)
Definition: xml.c:1951
void pg_xml_init_library(void)
xmltype * xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace)
Definition: xml.c:701
void pg_xml_done(PgXmlErrorContext *errcxt, bool isError)
XmlStandaloneType
Definition: xml.h:24
uintptr_t Datum
Definition: postgres.h:374
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:1835
int xmlbinary
Definition: xml.c:95
int xmloption
Definition: xml.c:96
xmltype * xmlroot(xmltype *data, text *version, int standalone)
Definition: xml.c:771
XmlOptionType
Definition: primnodes.h:1109
char * escape_xml(const char *str)
Definition: xml.c:2170
const char * name
Definition: encode.c:521
void * arg
char * map_xml_name_to_sql_identifier(char *name)
Definition: xml.c:1911
Definition: c.h:434
Definition: pg_list.h:45
PgXmlStrictness
Definition: xml.h:38
PgXmlErrorContext * pg_xml_init(PgXmlStrictness strictness)
void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode, const char *msg)