Re: [BUG?] XMLSERIALIZE( ... INDENT) won't work with blank nodes - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [BUG?] XMLSERIALIZE( ... INDENT) won't work with blank nodes
Date
Msg-id 2294688.1725640444@sss.pgh.pa.us
Whole thread Raw
In response to Re: [BUG?] XMLSERIALIZE( ... INDENT) won't work with blank nodes  (Jim Jones <jim.jones@uni-muenster.de>)
List pgsql-hackers
Jim Jones <jim.jones@uni-muenster.de> writes:
> mmh... xmlDocContentDumpOutput seems to add a trailing newline in the
> end of a document by default, making the serialization of the same xml
> string with DOCUMENT and CONTENT different:

Does seem a bit inconsistent.

> Or should we in this case consider something like this in
> xmltotext_with_options()?
> result = cstring_to_text_with_len((const char *) xmlBufferContent(buf),
> xmlBufferLength(buf) - 1);

I think it'd be quite foolish to assume that every extant and future
version of libxml2 will share this glitch.  Probably should use
logic more like pg_strip_crlf(), although we can't use that directly.

Would it ever be the case that trailing whitespace would be valid
data?  In a bit of testing, it seems like that could be true in
CONTENT mode but not DOCUMENT mode.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: Remove one TimestampTzGetDatum call in pg_stat_get_io()
Next
From: Matthias van de Meent
Date:
Subject: Re: PostgreSQL 17 release announcement draft