Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gnFBj-0002bA-KJ for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Jan 2019 04:03:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gnFBg-00080X-6I for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Jan 2019 04:03:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gnFBf-00080Q-VK for pgsql-hackers@lists.postgresql.org; Sat, 26 Jan 2019 04:03:20 +0000 Received: from bay.acenet.us ([173.230.252.50]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gnFBd-0001jq-DW for pgsql-hackers@lists.postgresql.org; Sat, 26 Jan 2019 04:03:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4C1H/Pc2CBrFYBVWAmRmyKORqsPaVaZDd4r3OGHQJ5k=; b=J+xO6O5kr5N5LGqVwBZs/MqWmO DmX6CVrp4g4NUY4ujT5mFpEBRljJdFY91E7tKdBUtgWNr81iUNF2iXJK0m35ENmTbMfmQaEqVFRdr ogkVS7hqa9CFHpUwqvsfvlLPdQbSuU0azdFKr+zaz7PYUM9k/gSU7tOcjs4Kvt7C8YmwccPZKmw/I eMlUkKkF172WO/TjCoJc1BG8Lxkiqg2gRGHtDGefdTdvec54bax7VSU805UhlGi8xLb+x+8M3n/Js rqCLSqA+tVAL3LEBbVKJKvf5C+gWl1tPPla2rRgcox/L2ptEcNoLUgV9I5k/sBkc1KTjZFKzfhEw7 I8Q51rqA==; Received: from [192.182.57.242] (port=54337) by bay.acenet.us with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1gnFBX-007ylY-QH; Fri, 25 Jan 2019 23:03:13 -0500 Subject: Re: PostgreSQL vs SQL/XML Standards To: Pavel Stehule References: <5C297BB7.9070509@anastigmatix.net> <5C3A7A90.3070207@anastigmatix.net> <5C43FAEB.2070000@anastigmatix.net> <5C4401BE.4080606@anastigmatix.net> <5C449C71.7060903@anastigmatix.net> <5C44B332.6070609@anastigmatix.net> <5C44F26D.5010703@anastigmatix.net> <5C4A94A5.8010402@anastigmatix.net> <5C4BABDC.4010600@anastigmatix.net> Cc: PostgreSQL Hackers , Markus Winand , Alvaro Herrera , Tom Lane From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5C4BDBFF.6040905@anastigmatix.net> Date: Fri, 25 Jan 2019 23:03:11 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <5C4BABDC.4010600@anastigmatix.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-OutGoing-Spam-Status: No, score=-95.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 —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