From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chapman Flack <chap@anastigmatix.net>
Cc: Ryan Lambert <ryan@rustprooflabs.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Fix XML handling with DOCTYPE
Date: Sat, 16 Mar 2019 17:21:12 -0400
Message-ID: <24203.1552771272@sss.pgh.pa.us> (raw)
In-Reply-To: <5C8D6681.4070504@anastigmatix.net>
References: <CAN-V+g-6JqUQEQZ55Q3toXEN6d5Ez5uvzL4VR+8KtvJKj31taw@mail.gmail.com>
<5C8D5D16.7090206@anastigmatix.net>
<23319.1552769738@sss.pgh.pa.us>
<5C8D6681.4070504@anastigmatix.net>
Chapman Flack <chap@anastigmatix.net> writes:
> On 03/16/19 16:55, Tom Lane wrote:
>> What do you think of the idea I just posted about parsing off the DOCTYPE
>> thing for ourselves, and not letting libxml see it?
> The principled way of doing that would be to pre-parse to find a DOCTYPE,
> and if there is one, leave it there and parse the input as we do for
> 'document'. Per XML, if there is a DOCTYPE, the document must satisfy
> the 'document' syntax requirements, and per SQL/XML:2006-and-later,
> 'content' is a proper superset of 'document', so if we were asked for
> 'content' and can successfully parse it as 'document', we're good,
> and if we see a DOCTYPE and yet it incurs a parse error as 'document',
> well, that's what needed to happen.
Hm, so, maybe just
(1) always try to parse as document. If successful, we're done.
(2) otherwise, if allowed by xmloption, try to parse using our
current logic for the CONTENT case.
This avoids adding any new assumptions about how libxml acts,
which is what I was hoping to achieve.
One interesting question is which error to report if both (1) and (2)
fail.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, chap@anastigmatix.net, ryan@rustprooflabs.com
Subject: Re: Fix XML handling with DOCTYPE
In-Reply-To: <24203.1552771272@sss.pgh.pa.us>
* 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