mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
Support [NO] INDENT option in XMLSERIALIZE().
This adds the ability to pretty-print XML documents ... according to libxml's somewhat idiosyncratic notions of what's pretty, anyway. One notable divergence from a strict reading of the spec is that libxml is willing to collapse empty nodes "<node></node>" to just "<node/>", whereas SQL and the underlying XML spec say that this option should only result in whitespace tweaks. Nonetheless, it seems close enough to justify using the SQL-standard syntax. Jim Jones, reviewed by Peter Smith and myself Discussion: https://postgr.es/m/2f5df461-dad8-6d7d-4568-08e10608a69b@uni-muenster.de
This commit is contained in:
@@ -840,6 +840,7 @@ typedef struct XmlSerialize
|
||||
XmlOptionType xmloption; /* DOCUMENT or CONTENT */
|
||||
Node *expr;
|
||||
TypeName *typeName;
|
||||
bool indent; /* [NO] INDENT */
|
||||
int location; /* token location, or -1 if unknown */
|
||||
} XmlSerialize;
|
||||
|
||||
|
||||
@@ -1464,7 +1464,7 @@ typedef enum XmlExprOp
|
||||
IS_XMLPARSE, /* XMLPARSE(text, is_doc, preserve_ws) */
|
||||
IS_XMLPI, /* XMLPI(name [, args]) */
|
||||
IS_XMLROOT, /* XMLROOT(xml, version, standalone) */
|
||||
IS_XMLSERIALIZE, /* XMLSERIALIZE(is_document, xmlval) */
|
||||
IS_XMLSERIALIZE, /* XMLSERIALIZE(is_document, xmlval, indent) */
|
||||
IS_DOCUMENT /* xmlval IS DOCUMENT */
|
||||
} XmlExprOp;
|
||||
|
||||
@@ -1489,6 +1489,8 @@ typedef struct XmlExpr
|
||||
List *args;
|
||||
/* DOCUMENT or CONTENT */
|
||||
XmlOptionType xmloption pg_node_attr(query_jumble_ignore);
|
||||
/* INDENT option for XMLSERIALIZE */
|
||||
bool indent;
|
||||
/* target type/typmod for XMLSERIALIZE */
|
||||
Oid type pg_node_attr(query_jumble_ignore);
|
||||
int32 typmod pg_node_attr(query_jumble_ignore);
|
||||
|
||||
Reference in New Issue
Block a user