pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chapman Flack <chap@anastigmatix.net>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Markus Winand <markus.winand@winand.at>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: PostgreSQL vs SQL/XML Standards
Date: Fri, 25 Jan 2019 23:03:11 -0500
Message-ID: <5C4BDBFF.6040905@anastigmatix.net> (raw)
In-Reply-To: <5C4BABDC.4010600@anastigmatix.net>
References: <CAFj8pRDFQJMoKf-X+3p1ASwU02nnXfAXrg83Z3fHUBd-Gwuuxw@mail.gmail.com>
	<5C297BB7.9070509@anastigmatix.net>
	<CAFj8pRCN=0k507nTfvNQuruHvomA4SiC6uGUXY5Gz0crxf-JAQ@mail.gmail.com>
	<5C3A7A90.3070207@anastigmatix.net>
	<CAFj8pRCSa0ekwc8AOUnEsLeJhWbq7_rOyFzruopfgBTaMpUWMA@mail.gmail.com>
	<5C43FAEB.2070000@anastigmatix.net>
	<CAFj8pRDLywawDY-dRsYdjF036iR_Y4em77X1DF7VodUqau_0Vg@mail.gmail.com>
	<5C4401BE.4080606@anastigmatix.net>
	<CAFj8pRCKwDGqP55RTykDq87DXuXStE+3Qy2Hf9Wxh_A-cUnwTw@mail.gmail.com>
	<5C449C71.7060903@anastigmatix.net>
	<CAFj8pRAabQWW13FS58fj1h6YxKsbhEaegRctf28TFeheWGn_3A@mail.gmail.com>
	<5C44B332.6070609@anastigmatix.net>
	<CAFj8pRAfjUJZX3so2TooQvag2C+5b1+sm4rzZuJkuO5UtDtkhg@mail.gmail.com>
	<5C44F26D.5010703@anastigmatix.net>
	<CAFj8pRCLXAU5wsdLksh4z8_2Sz5baVM9HOZntG1UqQ9tGrjkPQ@mail.gmail.com>
	<5C4A94A5.8010402@anastigmatix.net>
	<CAFj8pRAgWyDrLZJ9pUf7E-yqpR85RpGNtAP+PxEzSCOegwZjQA@mail.gmail.com>
	<5C4BABDC.4010600@anastigmatix.net>

On 01/25/19 19:37, Chapman Flack wrote:
> There is still nothing in this patch set to address [1], though that
> also seems worth doing, perhaps in another patch, and probably not
> difficult, perhaps needing only a regex.

Heck, it could be even simpler than that. If some XML input has a DTD,
the attempt to parse it as 'content' with libxml is sure to fail early
in the parse (because that's where the DTD is found). If libxml reports
enough error detail to show it failed because of a DTD—and it appears to:

DETAIL:  line 1: StartTag: invalid element name
<!DOCTYPE foo>

—then simply recognize that error and reparse as 'document' on the spot.
The early-failing first parse won't have cost much, and there is probably
next to nothing to gain by trying to be any more clever.

The one complication might that there seem to be versions of libxml that
report error detail differently (hence the variant regression test expected
files), so the code might have to recognize a couple different forms.

-Chap

> [1] https://www.postgresql.org/message-id/5BD1C44B.6040300%40anastigmatix.net





view thread (88+ messages)  latest in thread

Message-ID: <5C4BDBFF.6040905@anastigmatix.net>
Permalink:  ../5C4BDBFF.6040905@anastigmatix.net/
Also on:    postgresql.org/message-id/5C4BDBFF.6040905@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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: chap@anastigmatix.net, pavel.stehule@gmail.com, pgsql-hackers@lists.postgresql.org, markus.winand@winand.at, alvherre@2ndquadrant.com, tgl@sss.pgh.pa.us
  Subject: Re: PostgreSQL vs SQL/XML Standards
  In-Reply-To: <5C4BDBFF.6040905@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