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 #include "executor/tablefunc.h"
22 
23 typedef struct varlena xmltype;
24 
25 typedef enum
26 {
32 
33 typedef enum
34 {
38 
39 typedef enum
40 {
41  PG_XML_STRICTNESS_LEGACY, /* ignore errors unless function result
42  * indicates error condition */
43  PG_XML_STRICTNESS_WELLFORMED, /* ignore non-parser messages */
44  PG_XML_STRICTNESS_ALL /* report all notices/warnings/errors */
46 
47 /* struct PgXmlErrorContext is private to xml.c */
49 
50 #define DatumGetXmlP(X) ((xmltype *) PG_DETOAST_DATUM(X))
51 #define XmlPGetDatum(X) PointerGetDatum(X)
52 
53 #define PG_GETARG_XML_P(n) DatumGetXmlP(PG_GETARG_DATUM(n))
54 #define PG_RETURN_XML_P(x) PG_RETURN_POINTER(x)
55 
56 extern void pg_xml_init_library(void);
58 extern void pg_xml_done(PgXmlErrorContext *errcxt, bool isError);
59 extern bool pg_xml_error_occurred(PgXmlErrorContext *errcxt);
60 extern void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode,
61  const char *msg);
62 
63 extern xmltype *xmlconcat(List *args);
64 extern xmltype *xmlelement(XmlExpr *xexpr,
65  Datum *named_argvalue, bool *named_argnull,
66  Datum *argvalue, bool *argnull);
67 extern xmltype *xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace);
68 extern xmltype *xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null);
69 extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
70 extern bool xml_is_document(xmltype *arg);
71 extern text *xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg);
72 extern char *escape_xml(const char *str);
73 
74 extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, bool escape_period);
75 extern char *map_xml_name_to_sql_identifier(char *name);
76 extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings);
77 
78 extern int xmlbinary; /* XmlBinaryType, but int for guc enum */
79 
80 extern int xmloption; /* XmlOptionType, but int for guc enum */
81 
83 
84 #endif /* XML_H */
XmlBinaryType
Definition: xml.h:33
xmltype * xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null)
Definition: xml.c:768
xmltype * xmlconcat(List *args)
Definition: xml.c:510
bool pg_xml_error_occurred(PgXmlErrorContext *errcxt)
struct PgXmlErrorContext PgXmlErrorContext
Definition: xml.h:48
unsigned int Oid
Definition: postgres_ext.h:31
bool xml_is_document(xmltype *arg)
Definition: xml.c:886
char * map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings)
Definition: xml.c:2013
static struct @121 value
void pg_xml_init_library(void)
xmltype * xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace)
Definition: xml.c:750
void pg_xml_done(PgXmlErrorContext *errcxt, bool isError)
XmlStandaloneType
Definition: xml.h:25
uintptr_t Datum
Definition: postgres.h:372
text * xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg)
Definition: xml.c:613
char * map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, bool escape_period)
Definition: xml.c:1897
int xmlbinary
Definition: xml.c:96
int xmloption
Definition: xml.c:97
xmltype * xmlroot(xmltype *data, text *version, int standalone)
Definition: xml.c:820
XmlOptionType
Definition: primnodes.h:1133
char * escape_xml(const char *str)
Definition: xml.c:2232
const char * name
Definition: encode.c:521
const TableFuncRoutine XmlTableRoutine
Definition: xml.c:205
void * arg
char * map_xml_name_to_sql_identifier(char *name)
Definition: xml.c:1973
Definition: c.h:433
xmltype * xmlelement(XmlExpr *xexpr, Datum *named_argvalue, bool *named_argnull, Datum *argvalue, bool *argnull)
Definition: xml.c:626
Definition: pg_list.h:45
PgXmlStrictness
Definition: xml.h:39
PgXmlErrorContext * pg_xml_init(PgXmlStrictness strictness)
void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode, const char *msg)