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