Re: PostgreSQL vs SQL/XML Standards - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: PostgreSQL vs SQL/XML Standards
Date
Msg-id 5C4BDBFF.6040905@anastigmatix.net
Whole thread Raw
In response to Re: PostgreSQL vs SQL/XML Standards  (Chapman Flack <chap@anastigmatix.net>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: PostgreSQL vs SQL/XML Standards
Next
From: Chapman Flack
Date:
Subject: Re: PostgreSQL vs SQL/XML Standards