pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chapman Flack <chap@anastigmatix.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: mostafa_bit0108@hotmail.com
Cc: pgsql-bugs@lists.postgresql.org, Markus Winand <markus.winand@winand.at>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Subject: Re: BUG #16046: xpath returns CDATA tag along with the value in postgres 12
Date: Thu, 24 Oct 2019 19:34:09 -0400
Message-ID: <5DB234F1.1040706@anastigmatix.net> (raw)
In-Reply-To: <5DB23068.3080601@anastigmatix.net>
References: <16046-a04d0611e7a0c03a@postgresql.org>
	<10621.1571953091@sss.pgh.pa.us>
	<5DB23068.3080601@anastigmatix.net>

On 10/24/19 19:14, Chapman Flack wrote:
>  <![CDATA[select 5 & 6 <yahoo!>]]>
>  select 5 &amp; 6 &lt;yahoo!&gt;
> 
> Either form of result is correct, and having it respect the form that was
> used in the input might even be delightfully smart.
> 
> I haven't looked in the code just now to see if it is intentionally being
> delightfully smart, or more simplistic-and-lucky.

It appears to be probably unintentional-but-ok: libxml tags a CDATA
section differently (XML_CDATA_SECTION_NODE) than a text node
(XML_TEXT_NODE), so a CDATA node falls into the catch-all branch of

if (cur->type != XML_ATTRIBUTE_NODE && cur->type != XML_TEXT_NODE)

where it gets dumped faithfully by xmlNodeDump(), with the upshot
that the result always will be well-formed XML, and will respect whether
the input was supplied as CDATA or not. We could choose to say that's
what we meant it to do all along.

Regards,
-Chap





view thread (9+ messages)  latest in thread

Message-ID: <5DB234F1.1040706@anastigmatix.net>
Permalink:  ../5DB234F1.1040706@anastigmatix.net/
Also on:    postgresql.org/message-id/5DB234F1.1040706@anastigmatix.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: chap@anastigmatix.net, tgl@sss.pgh.pa.us, mostafa_bit0108@hotmail.com, markus.winand@winand.at, pavel.stehule@gmail.com
  Subject: Re: BUG #16046: xpath returns CDATA tag along with the value in postgres 12
  In-Reply-To: <5DB234F1.1040706@anastigmatix.net>
  References: <16046-a04d0611e7a0c03a@postgresql.org> <10621.1571953091@sss.pgh.pa.us> <5DB23068.3080601@anastigmatix.net> <5DB234F1.1040706@anastigmatix.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox