Re: [BUG?] XMLSERIALIZE( ... INDENT) won't work with blank nodes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Subject: Re: [BUG?] XMLSERIALIZE( ... INDENT) won't work with blank nodes
Date: 2024-09-06 16:34:04
Message-ID: 2294688.1725640444@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jim Jones <jim(dot)jones(at)uni-muenster(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan S. Katz 2024-09-06 17:03:54 Re: PostgreSQL 17 release announcement draft
Previous Message Bertrand Drouvot 2024-09-06 15:45:27 Re: Remove one TimestampTzGetDatum call in pg_stat_get_io()