Coverage Report

Created: 2025-06-13 06:06

/src/postgres/src/include/utils/xml.h
Line
Count
Source (jump to first uncovered line)
1
/*-------------------------------------------------------------------------
2
 *
3
 * xml.h
4
 *    Declarations for XML data type support.
5
 *
6
 *
7
 * Portions Copyright (c) 1996-2025, 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 "executor/tablefunc.h"
19
#include "fmgr.h"
20
#include "nodes/execnodes.h"
21
#include "nodes/primnodes.h"
22
23
typedef struct varlena xmltype;
24
25
typedef enum
26
{
27
  XML_STANDALONE_YES,
28
  XML_STANDALONE_NO,
29
  XML_STANDALONE_NO_VALUE,
30
  XML_STANDALONE_OMITTED,
31
}     XmlStandaloneType;
32
33
typedef enum
34
{
35
  XMLBINARY_BASE64,
36
  XMLBINARY_HEX,
37
}     XmlBinaryType;
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 */
45
} PgXmlStrictness;
46
47
/* struct PgXmlErrorContext is private to xml.c */
48
typedef struct PgXmlErrorContext PgXmlErrorContext;
49
50
static inline xmltype *
51
DatumGetXmlP(Datum X)
52
0
{
53
0
  return (xmltype *) PG_DETOAST_DATUM(X);
54
0
}
Unexecuted instantiation: gram.c:DatumGetXmlP
Unexecuted instantiation: parse_expr.c:DatumGetXmlP
Unexecuted instantiation: explain.c:DatumGetXmlP
Unexecuted instantiation: explain_format.c:DatumGetXmlP
Unexecuted instantiation: execExprInterp.c:DatumGetXmlP
Unexecuted instantiation: nodeTableFuncscan.c:DatumGetXmlP
Unexecuted instantiation: ruleutils.c:DatumGetXmlP
Unexecuted instantiation: xml.c:DatumGetXmlP
Unexecuted instantiation: guc_tables.c:DatumGetXmlP
55
56
static inline Datum
57
XmlPGetDatum(const xmltype *X)
58
0
{
59
0
  return PointerGetDatum(X);
60
0
}
Unexecuted instantiation: gram.c:XmlPGetDatum
Unexecuted instantiation: parse_expr.c:XmlPGetDatum
Unexecuted instantiation: explain.c:XmlPGetDatum
Unexecuted instantiation: explain_format.c:XmlPGetDatum
Unexecuted instantiation: execExprInterp.c:XmlPGetDatum
Unexecuted instantiation: nodeTableFuncscan.c:XmlPGetDatum
Unexecuted instantiation: ruleutils.c:XmlPGetDatum
Unexecuted instantiation: xml.c:XmlPGetDatum
Unexecuted instantiation: guc_tables.c:XmlPGetDatum
61
62
0
#define PG_GETARG_XML_P(n)  DatumGetXmlP(PG_GETARG_DATUM(n))
63
0
#define PG_RETURN_XML_P(x)  PG_RETURN_POINTER(x)
64
65
extern void pg_xml_init_library(void);
66
extern PgXmlErrorContext *pg_xml_init(PgXmlStrictness strictness);
67
extern void pg_xml_done(PgXmlErrorContext *errcxt, bool isError);
68
extern bool pg_xml_error_occurred(PgXmlErrorContext *errcxt);
69
extern void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode,
70
            const char *msg);
71
72
extern xmltype *xmlconcat(List *args);
73
extern xmltype *xmlelement(XmlExpr *xexpr,
74
               Datum *named_argvalue, bool *named_argnull,
75
               Datum *argvalue, bool *argnull);
76
extern xmltype *xmlparse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace);
77
extern xmltype *xmlpi(const char *target, text *arg, bool arg_is_null, bool *result_is_null);
78
extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
79
extern bool xml_is_document(xmltype *arg);
80
extern text *xmltotext_with_options(xmltype *data, XmlOptionType xmloption_arg,
81
                  bool indent);
82
extern char *escape_xml(const char *str);
83
84
extern char *map_sql_identifier_to_xml_name(const char *ident, bool fully_escaped, bool escape_period);
85
extern char *map_xml_name_to_sql_identifier(const char *name);
86
extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings);
87
88
extern PGDLLIMPORT int xmlbinary; /* XmlBinaryType, but int for guc enum */
89
90
extern PGDLLIMPORT int xmloption; /* XmlOptionType, but int for guc enum */
91
92
extern PGDLLIMPORT const TableFuncRoutine XmlTableRoutine;
93
94
#endif              /* XML_H */