Re: Postgresql XML parsing

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Ashoke <s(dot)ashoke(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Postgresql XML parsing
Date: 2014-03-12 13:52:37
Message-ID: 532066A5.2030307@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 03/12/2014 09:36 AM, Ashoke wrote:
> Hi,
>
> I am working on adding a functionality to PostgreSQL. I need to
> parse the XML format query plan (produced by PostgreSQL v9.3) and save
> it in a simple data structure (say C structure). I was wondering if
> PostgreSQL already had any parsing functions implemented that I can
> use to do the XML parsing. This is getting difficult as I was not able
> to get any DTD or XML Schema for the XML files generated by PostgreSQL.
>
> I found the files xpath.c/xslt_proc.c files that contain parsing
> related code, but none of the functions are being called for any xml
> related query I issue to the database and some of the functions in
> those files mention as deprecated.
>
> It would be greatly helpful if someone could guide me on this.
>
>

The only XML parsing we have is where Postgres is built with libxml, in
which case we use its parser. But query plan XML is delivered to a
client (or a log file, which means more or less the same thing here). If
you want to parse it then it should be parsed in the client - that's why
we provide it. Inside postgres I don't see a point in parsing the XML
rather than handling the query plan directly.

The worst possible option would be to make a hand-cut XML parser, either
in the client or the server - XML parsing has all sorts of wrinkles that
can bite you badly.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kouhei Kaigai 2014-03-12 13:54:32 pgstat wait timeout (RE: contrib/cache_scan)
Previous Message Ashoke 2014-03-12 13:36:37 Postgresql XML parsing