Re: review: xml_is_well_formed

From: Mike Fowler <mike(at)mlfowler(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: xml_is_well_formed
Date: 2010-08-06 08:28:17
Message-ID: 4C5BC7A1.1080602@mlfowler.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/08/10 16:15, Peter Eisentraut wrote:
> On lör, 2010-07-31 at 13:40 -0400, Robert Haas wrote:
>>> Well-formedness should probably only allow XML documents.
>>
>> I think the point of this function is to determine whether a cast to
>> xml will throw an error. The behavior should probably match exactly
>> whatever test would be applied there.
>
> Maybe there should be
>
> xml_is_well_formed()
> xml_is_well_formed_document()
> xml_is_well_formed_content()
>
> I agree that consistency with SQL/XML is desirable, but for someone
> coming from the outside, the unqualified claim that 'foo' is well-formed
> XML might sound suspicious.

What about making the function sensitive to the XML OPTION, such that:

test=# SET xmloption TO DOCUMENT;
SET
text=# SELECT xml_is_well_formed('foo');

xml_is_well_formed
--------------------
f
(1 row)

test=# SET xmloption TO CONTENT;
SET
text=# SELECT xml_is_well_formed('foo');

xml_is_well_formed
--------------------
t
(1 row)

with the inverse for DOCUMENTS? To me this makes the most sense as it makes the function behave much more like the other xml functions.

--
Mike Fowler
Registered Linux user: 379787

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2010-08-06 08:51:10 Re: MERGE Specification
Previous Message Boxuan Zhai 2010-08-06 08:26:58 Re: MERGE Specification