PostgreSQL Source Code: src/include/utils/xml.h File Reference (original) (raw)

Go to the source code of this file.

Enumerations
enum XmlStandaloneType { XML_STANDALONE_YES, XML_STANDALONE_NO, XML_STANDALONE_NO_VALUE, XML_STANDALONE_OMITTED }
enum XmlBinaryType { XMLBINARY_BASE64, XMLBINARY_HEX }
enum PgXmlStrictness { PG_XML_STRICTNESS_LEGACY, PG_XML_STRICTNESS_WELLFORMED, PG_XML_STRICTNESS_ALL }
Functions
static xmltype * DatumGetXmlP (Datum X)
static Datum XmlPGetDatum (const xmltype *X)
void pg_xml_init_library (void)
PgXmlErrorContext * pg_xml_init (PgXmlStrictness strictness)
void pg_xml_done (PgXmlErrorContext *errcxt, bool isError)
bool pg_xml_error_occurred (PgXmlErrorContext *errcxt)
void xml_ereport (PgXmlErrorContext *errcxt, int level, int sqlcode, const char *msg)
xmltype * xmlconcat (List *args)
xmltype * xmlelement (XmlExpr *xexpr, Datum *named_argvalue, bool *named_argnull, Datum *argvalue, bool *argnull)
xmltype * xmlparse (text *data, XmlOptionType xmloption_arg, bool preserve_whitespace)
xmltype * xmlpi (const char *target, text *arg, bool arg_is_null, bool *result_is_null)
xmltype * xmlroot (xmltype *data, text *version, int standalone)
bool xml_is_document (xmltype *arg)
text * xmltotext_with_options (xmltype *data, XmlOptionType xmloption_arg, bool indent)
char * escape_xml (const char *str)
char * map_sql_identifier_to_xml_name (const char *ident, bool fully_escaped, bool escape_period)
char * map_xml_name_to_sql_identifier (const char *name)
char * map_sql_value_to_xml_value (Datum value, Oid type, bool xml_escape_strings)
Variables
PGDLLIMPORT int xmlbinary
PGDLLIMPORT int xmloption
PGDLLIMPORT const TableFuncRoutine XmlTableRoutine

PG_GETARG_XML_P

Definition at line 62 of file xml.h.

PG_RETURN_XML_P

Definition at line 63 of file xml.h.

PgXmlErrorContext

Definition at line 48 of file xml.h.

xmltype

Definition at line 23 of file xml.h.

PgXmlStrictness

Enumerator
PG_XML_STRICTNESS_LEGACY
PG_XML_STRICTNESS_WELLFORMED
PG_XML_STRICTNESS_ALL

Definition at line 39 of file xml.h.

40{

42

@ PG_XML_STRICTNESS_LEGACY

@ PG_XML_STRICTNESS_WELLFORMED

XmlBinaryType

Enumerator
XMLBINARY_BASE64
XMLBINARY_HEX

Definition at line 33 of file xml.h.

XmlStandaloneType

Enumerator
XML_STANDALONE_YES
XML_STANDALONE_NO
XML_STANDALONE_NO_VALUE
XML_STANDALONE_OMITTED

Definition at line 25 of file xml.h.

26{

@ XML_STANDALONE_NO_VALUE

DatumGetXmlP()

escape_xml()

char * escape_xml ( const char * str )

map_sql_identifier_to_xml_name()

char * map_sql_identifier_to_xml_name ( const char * ident,
bool fully_escaped,
bool escape_period
)

Definition at line 2391 of file xml.c.

2393{

2394#ifdef USE_LIBXML

2396 const char *p;

2397

2398

2399

2400

2401

2402 Assert(fully_escaped || !escape_period);

2403

2405

2407 {

2408 if (*p == ':' && (p == ident || fully_escaped))

2410 else if (*p == '_' && *(p + 1) == 'x')

2412 else if (fully_escaped && p == ident &&

2414 {

2415 if (*p == 'x')

2417 else

2419 }

2420 else if (escape_period && *p == '.')

2422 else

2423 {

2424 pg_wchar u = sqlchar_to_unicode(p);

2425

2426 if ((p == ident)

2427 ? !is_valid_xml_namefirst(u)

2428 : !is_valid_xml_namechar(u))

2430 else

2432 }

2433 }

2434

2435 return buf.data;

2436#else

2438 return NULL;

2439#endif

2440}

Assert(PointerIsAligned(start, uint64))

int pg_mblen(const char *mbstr)

int pg_strncasecmp(const char *s1, const char *s2, size_t n)

void appendStringInfo(StringInfo str, const char *fmt,...)

void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)

References appendBinaryStringInfo(), appendStringInfo(), appendStringInfoString(), Assert(), buf, ident, initStringInfo(), NO_XML_SUPPORT, pg_mblen(), and pg_strncasecmp().

Referenced by database_to_xml_internal(), map_multipart_sql_identifier_to_xml_name(), map_sql_catalog_to_xmlschema_types(), map_sql_schema_to_xmlschema_types(), map_sql_table_to_xmlschema(), query_to_xml_internal(), schema_to_xml_internal(), SPI_sql_row_to_xmlelement(), and transformXmlExpr().

map_sql_value_to_xml_value()

char * map_sql_value_to_xml_value ( Datum value,
Oid type,
bool xml_escape_strings
)

Definition at line 2489 of file xml.c.

2490{

2492 {

2494 Oid elmtype;

2496 bool elmbyval;

2497 char elmalign;

2498 int num_elems;

2499 Datum *elem_values;

2500 bool *elem_nulls;

2502 int i;

2503

2507

2509 elmlen, elmbyval, elmalign,

2510 &elem_values, &elem_nulls,

2511 &num_elems);

2512

2514

2515 for (i = 0; i < num_elems; i++)

2516 {

2517 if (elem_nulls[i])

2518 continue;

2522 elmtype, true));

2524 }

2525

2526 pfree(elem_values);

2527 pfree(elem_nulls);

2528

2529 return buf.data;

2530 }

2531 else

2532 {

2533 Oid typeOut;

2534 bool isvarlena;

2535 char *str;

2536

2537

2538

2539

2540

2542

2543

2544

2545

2546 switch (type)

2547 {

2548 case BOOLOID:

2550 return "true";

2551 else

2552 return "false";

2553

2554 case DATEOID:

2555 {

2559

2561

2564 (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),

2565 errmsg("date out of range"),

2566 errdetail("XML does not support infinite date values.")));

2570

2572 }

2573

2574 case TIMESTAMPOID:

2575 {

2580

2582

2583

2586 (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),

2587 errmsg("timestamp out of range"),

2588 errdetail("XML does not support infinite timestamp values.")));

2591 else

2593 (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),

2594 errmsg("timestamp out of range")));

2595

2597 }

2598

2599 case TIMESTAMPTZOID:

2600 {

2603 int tz;

2605 const char *tzn = NULL;

2607

2609

2610

2613 (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),

2614 errmsg("timestamp out of range"),

2615 errdetail("XML does not support infinite timestamp values.")));

2618 else

2620 (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),

2621 errmsg("timestamp out of range")));

2622

2624 }

2625

2626#ifdef USE_LIBXML

2627 case BYTEAOID:

2628 {

2631 volatile xmlBufferPtr buf = NULL;

2632 volatile xmlTextWriterPtr writer = NULL;

2633 char *result;

2634

2636

2638 {

2639 buf = xmlBufferCreate();

2640 if (buf == NULL || xmlerrcxt->err_occurred)

2642 "could not allocate xmlBuffer");

2643 writer = xmlNewTextWriterMemory(buf, 0);

2644 if (writer == NULL || xmlerrcxt->err_occurred)

2646 "could not allocate xmlTextWriter");

2647

2649 xmlTextWriterWriteBase64(writer, VARDATA_ANY(bstr),

2651 else

2652 xmlTextWriterWriteBinHex(writer, VARDATA_ANY(bstr),

2654

2655

2656 xmlFreeTextWriter(writer);

2657 writer = NULL;

2658

2659 result = pstrdup((const char *) xmlBufferContent(buf));

2660 }

2662 {

2663 if (writer)

2664 xmlFreeTextWriter(writer);

2665 if (buf)

2666 xmlBufferFree(buf);

2667

2669

2671 }

2673

2674 xmlBufferFree(buf);

2675

2677

2678 return result;

2679 }

2680#endif

2681

2682 }

2683

2684

2685

2686

2689

2690

2691 if (type == XMLOID || !xml_escape_strings)

2692 return str;

2693

2694

2696 }

2697}

#define DatumGetArrayTypeP(X)

void deconstruct_array(ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp)

void j2date(int jd, int *year, int *month, int *day)

void EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str)

void EncodeDateOnly(struct pg_tm *tm, int style, char *str)

int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone)

#define TIMESTAMP_NOT_FINITE(j)

#define POSTGRES_EPOCH_JDATE

#define DATE_NOT_FINITE(j)

static DateADT DatumGetDateADT(Datum X)

int errdetail(const char *fmt,...)

int errcode(int sqlerrcode)

int errmsg(const char *fmt,...)

#define ereport(elevel,...)

char * OidOutputFunctionCall(Oid functionId, Datum val)

#define DatumGetByteaPP(X)

void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)

void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, char *typalign)

Oid getBaseType(Oid typid)

#define type_is_array_domain(typid)

char * pstrdup(const char *in)

void pfree(void *pointer)

static bool DatumGetBool(Datum X)

static Timestamp DatumGetTimestamp(Datum X)

#define VARSIZE_ANY_EXHDR(PTR)

char * map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings)

char * escape_xml(const char *str)

struct PgXmlErrorContext PgXmlErrorContext

PgXmlErrorContext * pg_xml_init(PgXmlStrictness strictness)

void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode, const char *msg)

void pg_xml_done(PgXmlErrorContext *errcxt, bool isError)

References appendStringInfoString(), ARR_ELEMTYPE, buf, DATE_NOT_FINITE, DatumGetArrayTypeP, DatumGetBool(), DatumGetByteaPP, DatumGetDateADT(), DatumGetTimestamp(), deconstruct_array(), EncodeDateOnly(), EncodeDateTime(), ereport, errcode(), errdetail(), errmsg(), ERROR, escape_xml(), get_typlenbyvalalign(), getBaseType(), getTypeOutputInfo(), i, initStringInfo(), j2date(), map_sql_value_to_xml_value(), MAXDATELEN, OidOutputFunctionCall(), pfree(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, pg_xml_done(), pg_xml_init(), PG_XML_STRICTNESS_ALL, POSTGRES_EPOCH_JDATE, pstrdup(), str, timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, pg_tm::tm_mday, pg_tm::tm_mon, pg_tm::tm_year, type, type_is_array_domain, USE_XSD_DATES, value, VARDATA_ANY, VARSIZE_ANY_EXHDR, xml_ereport(), xmlbinary, and XMLBINARY_BASE64.

Referenced by ExecEvalXmlExpr(), map_sql_value_to_xml_value(), SPI_sql_row_to_xmlelement(), and xmlelement().

map_xml_name_to_sql_identifier()

char * map_xml_name_to_sql_identifier ( const char * name )

Definition at line 2447 of file xml.c.

2448{

2450 const char *p;

2451

2453

2455 {

2456 if (*p == '_' && *(p + 1) == 'x'

2457 && isxdigit((unsigned char) *(p + 2))

2458 && isxdigit((unsigned char) *(p + 3))

2459 && isxdigit((unsigned char) *(p + 4))

2460 && isxdigit((unsigned char) *(p + 5))

2461 && *(p + 6) == '_')

2462 {

2464 unsigned int u;

2465

2466 sscanf(p + 2, "%X", &u);

2469 p += 6;

2470 }

2471 else

2473 }

2474

2475 return buf.data;

2476}

void pg_unicode_to_server(pg_wchar c, unsigned char *s)

#define MAX_UNICODE_EQUIVALENT_STRING

References appendBinaryStringInfo(), appendStringInfoString(), buf, initStringInfo(), MAX_UNICODE_EQUIVALENT_STRING, name, pg_mblen(), and pg_unicode_to_server().

Referenced by get_rule_expr().

pg_xml_done()

pg_xml_error_occurred()

pg_xml_init()

pg_xml_init_library()

void pg_xml_init_library ( void )

xml_ereport()

void xml_ereport ( PgXmlErrorContext * errcxt,
int level,
int sqlcode,
const char * msg
)

Referenced by map_sql_value_to_xml_value(), pgxml_xpath(), xmlelement(), XmlTableFetchRow(), XmlTableGetValue(), XmlTableInitOpaque(), XmlTableSetColumnFilter(), XmlTableSetDocument(), XmlTableSetNamespace(), XmlTableSetRowFilter(), xmltotext_with_options(), xpath_table(), and xslt_process().

xml_is_document()

bool xml_is_document ( xmltype * arg )

xmlconcat()

Definition at line 553 of file xml.c.

554{

555#ifdef USE_LIBXML

556 int global_standalone = 1;

557 xmlChar *global_version = NULL;

558 bool global_version_no_value = false;

561

563 foreach(v, args)

564 {

566 size_t len;

567 xmlChar *version;

568 int standalone;

569 char *str;

570

573

574 parse_xml_decl((xmlChar *) str, &len, &version, NULL, &standalone);

575

576 if (standalone == 0 && global_standalone == 1)

577 global_standalone = 0;

578 if (standalone < 0)

579 global_standalone = -1;

580

581 if (!version)

582 global_version_no_value = true;

583 else if (!global_version)

584 global_version = version;

585 else if (xmlStrcmp(version, global_version) != 0)

586 global_version_no_value = true;

587

590 }

591

592 if (!global_version_no_value || global_standalone >= 0)

593 {

595

597

598 print_xml_decl(&buf2,

599 (!global_version_no_value) ? global_version : NULL,

600 0,

601 global_standalone);

602

604 buf = buf2;

605 }

606

608#else

610 return NULL;

611#endif

612}

static Datum PointerGetDatum(const void *X)

char * text_to_cstring(const text *t)

static xmltype * stringinfo_to_xmltype(StringInfo buf)

static xmltype * DatumGetXmlP(Datum X)

References appendBinaryStringInfo(), appendStringInfoString(), generate_unaccent_rules::args, buf, DatumGetXmlP(), initStringInfo(), len, lfirst, NO_XML_SUPPORT, pfree(), PointerGetDatum(), str, stringinfo_to_xmltype(), text_to_cstring(), VARHDRSZ, VARSIZE, and x.

Referenced by ExecEvalXmlExpr(), and xmlconcat2().

xmlelement()

xmltype * xmlelement ( XmlExpr * xexpr,
Datum * named_argvalue,
bool * named_argnull,
Datum * argvalue,
bool * argnull
)

Definition at line 864 of file xml.c.

867{

868#ifdef USE_LIBXML

870 List *named_arg_strings;

871 List *arg_strings;

872 int i;

876 volatile xmlBufferPtr buf = NULL;

877 volatile xmlTextWriterPtr writer = NULL;

878

879

880

881

882

883

884

885

886 named_arg_strings = NIL;

887 i = 0;

889 {

891 char *str;

892

893 if (named_argnull[i])

894 str = NULL;

895 else

898 false);

899 named_arg_strings = lappend(named_arg_strings, str);

900 i++;

901 }

902

903 arg_strings = NIL;

904 i = 0;

905 foreach(arg, xexpr->args)

906 {

908 char *str;

909

910

911 if (!argnull[i])

912 {

915 true);

916 arg_strings = lappend(arg_strings, str);

917 }

918 i++;

919 }

920

922

924 {

925 buf = xmlBufferCreate();

926 if (buf == NULL || xmlerrcxt->err_occurred)

928 "could not allocate xmlBuffer");

929 writer = xmlNewTextWriterMemory(buf, 0);

930 if (writer == NULL || xmlerrcxt->err_occurred)

932 "could not allocate xmlTextWriter");

933

934 xmlTextWriterStartElement(writer, (xmlChar *) xexpr->name);

935

936 forboth(arg, named_arg_strings, narg, xexpr->arg_names)

937 {

940

942 xmlTextWriterWriteAttribute(writer,

943 (xmlChar *) argname,

944 (xmlChar *) str);

945 }

946

947 foreach(arg, arg_strings)

948 {

950

951 xmlTextWriterWriteRaw(writer, (xmlChar *) str);

952 }

953

954 xmlTextWriterEndElement(writer);

955

956

957 xmlFreeTextWriter(writer);

958 writer = NULL;

959

960 result = xmlBuffer_to_xmltype(buf);

961 }

963 {

964 if (writer)

965 xmlFreeTextWriter(writer);

967 xmlBufferFree(buf);

968

970

972 }

974

975 xmlBufferFree(buf);

976

978

979 return result;

980#else

982 return NULL;

983#endif

984}

List * lappend(List *list, void *datum)

Oid exprType(const Node *expr)

#define forboth(cell1, list1, cell2, list2)

References arg, XmlExpr::args, buf, ERROR, exprType(), forboth, i, lappend(), lfirst, map_sql_value_to_xml_value(), XmlExpr::named_args, NIL, NO_XML_SUPPORT, PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, pg_xml_done(), pg_xml_init(), PG_XML_STRICTNESS_ALL, str, strVal, and xml_ereport().

Referenced by ExecEvalXmlExpr().

xmlparse()

XmlPGetDatum()

xmlpi()

xmltype * xmlpi ( const char * target,
text * arg,
bool arg_is_null,
bool * result_is_null
)

Definition at line 1006 of file xml.c.

1007{

1008#ifdef USE_LIBXML

1011

1014 (errcode(ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION),

1015 errmsg("invalid XML processing instruction"),

1016 errdetail("XML processing instruction target name cannot be \"%s\".", target)));

1017

1018

1019

1020

1021

1022 *result_is_null = arg_is_null;

1023 if (*result_is_null)

1024 return NULL;

1025

1027

1029

1030 if (arg != NULL)

1031 {

1033

1035 if (strstr(string, "?>") != NULL)

1037 (errcode(ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION),

1038 errmsg("invalid XML processing instruction"),

1039 errdetail("XML processing instruction cannot contain \"?>\".")));

1040

1044 }

1046

1049 return result;

1050#else

1052 return NULL;

1053#endif

1054}

int pg_strcasecmp(const char *s1, const char *s2)

void appendStringInfoChar(StringInfo str, char ch)

References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), arg, buf, ereport, errcode(), errdetail(), errmsg(), ERROR, initStringInfo(), NO_XML_SUPPORT, pfree(), pg_strcasecmp(), stringinfo_to_xmltype(), and text_to_cstring().

Referenced by ExecEvalXmlExpr().

xmlroot()

Definition at line 1058 of file xml.c.

1059{

1060#ifdef USE_LIBXML

1061 char *str;

1062 size_t len;

1063 xmlChar *orig_version;

1064 int orig_standalone;

1066

1069

1070 parse_xml_decl((xmlChar *) str, &len, &orig_version, NULL, &orig_standalone);

1071

1072 if (version)

1073 orig_version = xml_text2xmlChar(version);

1074 else

1075 orig_version = NULL;

1076

1077 switch (standalone)

1078 {

1080 orig_standalone = 1;

1081 break;

1083 orig_standalone = 0;

1084 break;

1086 orig_standalone = -1;

1087 break;

1089

1090 break;

1091 }

1092

1094 print_xml_decl(&buf, orig_version, 0, orig_standalone);

1096

1098#else

1100 return NULL;

1101#endif

1102}

References appendStringInfoString(), buf, data, initStringInfo(), len, NO_XML_SUPPORT, str, stringinfo_to_xmltype(), text_to_cstring(), VARHDRSZ, VARSIZE, XML_STANDALONE_NO, XML_STANDALONE_NO_VALUE, XML_STANDALONE_OMITTED, and XML_STANDALONE_YES.

Referenced by ExecEvalXmlExpr().

xmltotext_with_options()

Definition at line 656 of file xml.c.

657{

658#ifdef USE_LIBXML

659 text *volatile result;

660 xmlDocPtr doc;

662 xmlNodePtr content_nodes;

663 volatile xmlBufferPtr buf = NULL;

664 volatile xmlSaveCtxtPtr ctxt = NULL;

667#endif

668

670 {

671

672

673

674

675

677 }

678

679#ifdef USE_LIBXML

680

681

682

683

684

685

686

688 &parsed_xmloptiontype, &content_nodes,

689 (Node *) &escontext);

691 {

692 if (doc)

693 xmlFreeDoc(doc);

694

696 (errcode(ERRCODE_NOT_AN_XML_DOCUMENT),

697 errmsg("not an XML document")));

698 }

699

700

701 if (!indent)

702 {

703 xmlFreeDoc(doc);

705 }

706

707

709

711 {

712 size_t decl_len = 0;

713

714

715 buf = xmlBufferCreate();

716

717 if (buf == NULL || xmlerrcxt->err_occurred)

719 "could not allocate xmlBuffer");

720

721

722 parse_xml_decl(xml_text2xmlChar(data), &decl_len, NULL, NULL, NULL);

723

724

725

726

727

728

729

730 if (decl_len == 0)

731 ctxt = xmlSaveToBuffer(buf, NULL,

732 XML_SAVE_NO_DECL | XML_SAVE_FORMAT);

733 else

734 ctxt = xmlSaveToBuffer(buf, NULL,

735 XML_SAVE_FORMAT);

736

737 if (ctxt == NULL || xmlerrcxt->err_occurred)

739 "could not allocate xmlSaveCtxt");

740

742 {

743

744 if (xmlSaveDoc(ctxt, doc) == -1 || xmlerrcxt->err_occurred)

746 "could not save document to xmlBuffer");

747 }

748 else if (content_nodes != NULL)

749 {

750

751

752

753

754

755

756 xmlNodePtr root;

757 xmlNodePtr oldroot;

759

760 root = xmlNewNode(NULL, (const xmlChar *) "content-root");

761 if (root == NULL || xmlerrcxt->err_occurred)

763 "could not allocate xml node");

764

765

766

767

768

769 oldroot = xmlDocSetRootElement(doc, root);

770 if (oldroot != NULL)

771 xmlFreeNode(oldroot);

772

773 xmlAddChildList(root, content_nodes);

774

775

776

777

778

779

780

781

782 newline = xmlNewDocText(NULL, (const xmlChar *) "\n");

783 if (newline == NULL || xmlerrcxt->err_occurred)

785 "could not allocate xml node");

786

787 for (xmlNodePtr node = root->children; node; node = node->next)

788 {

789

790 if (node->type != XML_TEXT_NODE && node->prev != NULL)

791 {

792 if (xmlSaveTree(ctxt, newline) == -1 || xmlerrcxt->err_occurred)

793 {

796 "could not save newline to xmlBuffer");

797 }

798 }

799

800 if (xmlSaveTree(ctxt, node) == -1 || xmlerrcxt->err_occurred)

801 {

804 "could not save content to xmlBuffer");

805 }

806 }

807

809 }

810

811 if (xmlSaveClose(ctxt) == -1 || xmlerrcxt->err_occurred)

812 {

813 ctxt = NULL;

815 "could not close xmlSaveCtxtPtr");

816 }

817

818

819

820

822 {

823 const char *str = (const char *) xmlBufferContent(buf);

824 int len = xmlBufferLength(buf);

825

826 while (len > 0 && (str[len - 1] == '\n' ||

827 str[len - 1] == '\r'))

829

831 }

832 else

833 result = (text *) xmlBuffer_to_xmltype(buf);

834 }

836 {

837 if (ctxt)

838 xmlSaveClose(ctxt);

840 xmlBufferFree(buf);

841 if (doc)

842 xmlFreeDoc(doc);

843

845

847 }

849

850 xmlBufferFree(buf);

851 xmlFreeDoc(doc);

852

854

855 return result;

856#else

858 return NULL;

859#endif

860}

text * cstring_to_text_with_len(const char *s, int len)

References buf, cstring_to_text_with_len(), data, ereport, errcode(), errmsg(), ERROR, ErrorSaveContext::error_occurred, GetDatabaseEncoding(), len, newline, NO_XML_SUPPORT, PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, pg_xml_done(), pg_xml_init(), PG_XML_STRICTNESS_ALL, root, str, xml_ereport(), and XMLOPTION_DOCUMENT.

Referenced by ExecEvalXmlExpr().

xmlbinary

xmloption

XmlTableRoutine