2006-12-21 17:05:16 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* xml.h
|
|
|
|
* Declarations for XML data type support.
|
|
|
|
*
|
|
|
|
*
|
2010-01-02 17:58:17 +01:00
|
|
|
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
2006-12-21 17:05:16 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
2010-08-13 20:36:26 +02:00
|
|
|
* $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.34 2010/08/13 18:36:26 tgl Exp $
|
2006-12-21 17:05:16 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef XML_H
|
|
|
|
#define XML_H
|
|
|
|
|
|
|
|
#include "fmgr.h"
|
2007-01-10 21:33:54 +01:00
|
|
|
#include "nodes/execnodes.h"
|
2007-02-03 15:06:56 +01:00
|
|
|
#include "nodes/primnodes.h"
|
2006-12-21 17:05:16 +01:00
|
|
|
|
|
|
|
typedef struct varlena xmltype;
|
|
|
|
|
|
|
|
#define DatumGetXmlP(X) ((xmltype *) PG_DETOAST_DATUM(X))
|
2007-02-03 15:06:56 +01:00
|
|
|
#define XmlPGetDatum(X) PointerGetDatum(X)
|
2006-12-21 17:05:16 +01:00
|
|
|
|
|
|
|
#define PG_GETARG_XML_P(n) DatumGetXmlP(PG_GETARG_DATUM(n))
|
|
|
|
#define PG_RETURN_XML_P(x) PG_RETURN_POINTER(x)
|
|
|
|
|
|
|
|
extern Datum xml_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum xml_out(PG_FUNCTION_ARGS);
|
2006-12-28 15:28:36 +01:00
|
|
|
extern Datum xml_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum xml_send(PG_FUNCTION_ARGS);
|
2006-12-21 17:05:16 +01:00
|
|
|
extern Datum xmlcomment(PG_FUNCTION_ARGS);
|
2007-01-20 10:27:20 +01:00
|
|
|
extern Datum xmlconcat2(PG_FUNCTION_ARGS);
|
2006-12-24 01:29:20 +01:00
|
|
|
extern Datum texttoxml(PG_FUNCTION_ARGS);
|
2007-02-03 15:06:56 +01:00
|
|
|
extern Datum xmltotext(PG_FUNCTION_ARGS);
|
2006-12-21 17:05:16 +01:00
|
|
|
extern Datum xmlvalidate(PG_FUNCTION_ARGS);
|
2007-05-21 19:10:29 +02:00
|
|
|
extern Datum xpath(PG_FUNCTION_ARGS);
|
2010-08-08 21:15:27 +02:00
|
|
|
extern Datum xpath_exists(PG_FUNCTION_ARGS);
|
2010-08-05 06:21:54 +02:00
|
|
|
extern Datum xmlexists(PG_FUNCTION_ARGS);
|
2010-08-13 20:36:26 +02:00
|
|
|
extern Datum xml_is_well_formed(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum xml_is_well_formed_document(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum xml_is_well_formed_content(PG_FUNCTION_ARGS);
|
2006-12-21 17:05:16 +01:00
|
|
|
|
2007-02-16 08:46:55 +01:00
|
|
|
extern Datum table_to_xml(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum query_to_xml(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum cursor_to_xml(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum table_to_xmlschema(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum query_to_xmlschema(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum cursor_to_xmlschema(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum table_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum query_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
|
2007-04-01 11:00:26 +02:00
|
|
|
|
|
|
|
extern Datum schema_to_xml(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum schema_to_xmlschema(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum schema_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
|
|
|
|
|
|
|
|
extern Datum database_to_xml(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum database_to_xmlschema(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum database_to_xml_and_xmlschema(PG_FUNCTION_ARGS);
|
2007-02-16 08:46:55 +01:00
|
|
|
|
2007-01-25 12:53:52 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
XML_STANDALONE_YES,
|
|
|
|
XML_STANDALONE_NO,
|
|
|
|
XML_STANDALONE_NO_VALUE,
|
|
|
|
XML_STANDALONE_OMITTED
|
2007-11-15 23:25:18 +01:00
|
|
|
} XmlStandaloneType;
|
2007-01-25 12:53:52 +01:00
|
|
|
|
2010-03-03 18:29:45 +01:00
|
|
|
extern void pg_xml_init(void);
|
|
|
|
extern void xml_ereport(int level, int sqlcode, const char *msg);
|
2007-01-20 10:27:20 +01:00
|
|
|
extern xmltype *xmlconcat(List *args);
|
2007-11-15 23:25:18 +01:00
|
|
|
extern xmltype *xmlelement(XmlExprState *xmlExpr, ExprContext *econtext);
|
2007-02-03 15:06:56 +01:00
|
|
|
extern xmltype *xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace);
|
2007-01-07 23:49:56 +01:00
|
|
|
extern xmltype *xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null);
|
2007-11-15 23:25:18 +01:00
|
|
|
extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
|
|
|
|
extern bool xml_is_document(xmltype *arg);
|
|
|
|
extern text *xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg);
|
2009-08-10 07:46:50 +02:00
|
|
|
extern char *escape_xml(const char *str);
|
2006-12-24 01:29:20 +01:00
|
|
|
|
2007-02-11 23:18:16 +01:00
|
|
|
extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, bool escape_period);
|
2006-12-29 11:50:22 +01:00
|
|
|
extern char *map_xml_name_to_sql_identifier(char *name);
|
2009-06-10 00:00:57 +02:00
|
|
|
extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings);
|
2006-12-21 17:05:16 +01:00
|
|
|
|
2007-01-19 17:58:46 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
XMLBINARY_BASE64,
|
|
|
|
XMLBINARY_HEX
|
2007-11-15 23:25:18 +01:00
|
|
|
} XmlBinaryType;
|
2007-01-19 17:58:46 +01:00
|
|
|
|
2009-06-11 16:49:15 +02:00
|
|
|
extern int xmlbinary; /* XmlBinaryType, but int for guc enum */
|
2007-01-19 17:58:46 +01:00
|
|
|
|
2009-06-11 16:49:15 +02:00
|
|
|
extern int xmloption; /* XmlOptionType, but int for guc enum */
|
2007-01-25 12:53:52 +01:00
|
|
|
|
2007-11-15 22:14:46 +01:00
|
|
|
#endif /* XML_H */
|