Header And Logo

PostgreSQL
| The world's most advanced open source database.

xml.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * xml.h
00004  *    Declarations for XML data type support.
00005  *
00006  *
00007  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00008  * Portions Copyright (c) 1994, Regents of the University of California
00009  *
00010  * src/include/utils/xml.h
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 
00015 #ifndef XML_H
00016 #define XML_H
00017 
00018 #include "fmgr.h"
00019 #include "nodes/execnodes.h"
00020 #include "nodes/primnodes.h"
00021 
00022 typedef struct varlena xmltype;
00023 
00024 typedef enum
00025 {
00026     XML_STANDALONE_YES,
00027     XML_STANDALONE_NO,
00028     XML_STANDALONE_NO_VALUE,
00029     XML_STANDALONE_OMITTED
00030 }   XmlStandaloneType;
00031 
00032 typedef enum
00033 {
00034     XMLBINARY_BASE64,
00035     XMLBINARY_HEX
00036 }   XmlBinaryType;
00037 
00038 typedef enum
00039 {
00040     PG_XML_STRICTNESS_LEGACY,   /* ignore errors unless function result
00041                                  * indicates error condition */
00042     PG_XML_STRICTNESS_WELLFORMED,       /* ignore non-parser messages */
00043     PG_XML_STRICTNESS_ALL       /* report all notices/warnings/errors */
00044 } PgXmlStrictness;
00045 
00046 /* struct PgXmlErrorContext is private to xml.c */
00047 typedef struct PgXmlErrorContext PgXmlErrorContext;
00048 
00049 #define DatumGetXmlP(X)     ((xmltype *) PG_DETOAST_DATUM(X))
00050 #define XmlPGetDatum(X)     PointerGetDatum(X)
00051 
00052 #define PG_GETARG_XML_P(n)  DatumGetXmlP(PG_GETARG_DATUM(n))
00053 #define PG_RETURN_XML_P(x)  PG_RETURN_POINTER(x)
00054 
00055 extern Datum xml_in(PG_FUNCTION_ARGS);
00056 extern Datum xml_out(PG_FUNCTION_ARGS);
00057 extern Datum xml_recv(PG_FUNCTION_ARGS);
00058 extern Datum xml_send(PG_FUNCTION_ARGS);
00059 extern Datum xmlcomment(PG_FUNCTION_ARGS);
00060 extern Datum xmlconcat2(PG_FUNCTION_ARGS);
00061 extern Datum texttoxml(PG_FUNCTION_ARGS);
00062 extern Datum xmltotext(PG_FUNCTION_ARGS);
00063 extern Datum xmlvalidate(PG_FUNCTION_ARGS);
00064 extern Datum xpath(PG_FUNCTION_ARGS);
00065 extern Datum xpath_exists(PG_FUNCTION_ARGS);
00066 extern Datum xmlexists(PG_FUNCTION_ARGS);
00067 extern Datum xml_is_well_formed(PG_FUNCTION_ARGS);
00068 extern Datum xml_is_well_formed_document(PG_FUNCTION_ARGS);
00069 extern Datum xml_is_well_formed_content(PG_FUNCTION_ARGS);
00070 
00071 extern Datum table_to_xml(PG_FUNCTION_ARGS);
00072 extern Datum query_to_xml(PG_FUNCTION_ARGS);
00073 extern Datum cursor_to_xml(PG_FUNCTION_ARGS);
00074 extern Datum table_to_xmlschema(PG_FUNCTION_ARGS);
00075 extern Datum query_to_xmlschema(PG_FUNCTION_ARGS);
00076 extern Datum cursor_to_xmlschema(PG_FUNCTION_ARGS);
00077 extern Datum table_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
00078 extern Datum query_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
00079 
00080 extern Datum schema_to_xml(PG_FUNCTION_ARGS);
00081 extern Datum schema_to_xmlschema(PG_FUNCTION_ARGS);
00082 extern Datum schema_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
00083 
00084 extern Datum database_to_xml(PG_FUNCTION_ARGS);
00085 extern Datum database_to_xmlschema(PG_FUNCTION_ARGS);
00086 extern Datum database_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
00087 
00088 extern void pg_xml_init_library(void);
00089 extern PgXmlErrorContext *pg_xml_init(PgXmlStrictness strictness);
00090 extern void pg_xml_done(PgXmlErrorContext *errcxt, bool isError);
00091 extern bool pg_xml_error_occurred(PgXmlErrorContext *errcxt);
00092 extern void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode,
00093             const char *msg);
00094 
00095 extern xmltype *xmlconcat(List *args);
00096 extern xmltype *xmlelement(XmlExprState *xmlExpr, ExprContext *econtext);
00097 extern xmltype *xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace);
00098 extern xmltype *xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null);
00099 extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
00100 extern bool xml_is_document(xmltype *arg);
00101 extern text *xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg);
00102 extern char *escape_xml(const char *str);
00103 
00104 extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, bool escape_period);
00105 extern char *map_xml_name_to_sql_identifier(char *name);
00106 extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings);
00107 
00108 extern int  xmlbinary;          /* XmlBinaryType, but int for guc enum */
00109 
00110 extern int  xmloption;          /* XmlOptionType, but int for guc enum */
00111 
00112 #endif   /* XML_H */