Re: Issue: Deprecation of the XML2 module 'xml_is_well_formed' function

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Mike Rylander <mrylander(at)gmail(dot)com>
Cc: Mike Berrow <mberrow(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Issue: Deprecation of the XML2 module 'xml_is_well_formed' function
Date: 2010-06-28 16:07:16
Message-ID: AANLkTinqA1HEdYh92X--iqi3YQA_7uOyAq9aN4HybBEc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 28, 2010 at 11:42 AM, Mike Rylander <mrylander(at)gmail(dot)com> wrote:
> You could do something like this (untested):
>
> CREATE OR REPLACE FUNCTION my_xml_is_valid ( x TEXT ) RETURNS BOOL AS $$
> BEGIN
>  PERFORM XMLPARSE( DOCUMENT x::XML );
>  RETURN TRUE;
> EXCEPTION WHEN OTHERS THEN
>  RETURN FALSE;
> END;
> $$ LANGUAGE PLPGSQL;

This might perform significantly worse, though: exception handling ain't cheap.

It's not a bad workaround, but I think the OP has a point.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-06-28 16:17:45 Re: get_whatever_oid, part 1: object types with unqualifed names
Previous Message Robert Haas 2010-06-28 16:04:22 Re: get_whatever_oid, part 1: object types with unqualifed names