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

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

Yes, I went ahead and tried the original suggestion.

Here is what the added function went in as:

CREATE OR REPLACE FUNCTION xml_is_ok(x text)
RETURNS boolean AS
$BODY$
BEGIN
PERFORM XMLPARSE( DOCUMENT x::XML );
RETURN TRUE;
EXCEPTION WHEN OTHERS THEN
RETURN FALSE;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
ALTER FUNCTION xml_is_ok(text) OWNER TO postgres;

It worked fine. Thanks Mike and David.

The only other issue is that when I benchmarked it on a 5,000 record data
set that I have,
the original XML2 function ('xml_is_well_formed') took about 9.5 seconds
and this (deprecation driven) replacement took about 17.2 seconds.

-- Mike Berrow

On Mon, Jun 28, 2010 at 7:51 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Mon, Jun 28, 2010 at 11:03 AM, Mike Berrow <mberrow(at)gmail(dot)com> wrote:
> > Is there some way to use the new, core XML functionality to simply return
> a
> > truth value
> > in the way that we need?.
>
> Have you tried using a wrapper function like the one suggested
> independently by Mike Rylander and David Fetter upthread? If so,
> how'd it work out for you?
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise Postgres Company
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2010-06-29 03:48:08 Re: keepalives on MacOS X
Previous Message Robert Haas 2010-06-29 02:51:36 Re: Issue: Deprecation of the XML2 module 'xml_is_well_formed' function