Thread: XPath and XML support

XPath and XML support

From
Frank Cohen
Date:
I'm doing a performance and scalability test project for a PostgreSQL
user who is working with geospatial data. The data is in GML form.
For instance:


<watch version="9" id="flight" time="2006-08-16T10:16:36.125-07:00">
<point latitude="7" longitude="55"/>
<detail>
   <gml:Point xmlns:gml="http://www.opengis.net/gml">
     <gml:coordinates>7.0,9.0</gml:coordinates>
   </gml:Point>
</detail>
</watch>


I installed PostGIS and it supports Point and coordinates very well.

I an not sure what I should do with the XML content using PostgreSQL?
For example,

1) Tom Dyson at http://www.throwingbeans.org/
postgresql_and_xml_updated.html says "PostgreSQL 8 ships with
xpath_table to evaluate a set of XPath queries and returns the
results as a virtual table."

These look like good XPath functions. Are they actually in PSQL
8.1.4? I did not find them in the Windows installed version. If not,
are they recommended?

2) What is the relationship of the XPath functions to the PostGIS
functions? For example, will I be able to use an index to a PostGIS
field?

3) If the XPath operators are not allowed, should I shred the GML
into two tables (point and detail)?

Any help is much appreciated.

Thanks.

-Frank

---
Frank Cohen, Raining Data, http://www.RainingData.com, phone: 408 236
7604
http://www.xquerynow.com for free XML, XQuery and native XML database
tips,
techniques and solutions.







Re: XPath and XML support

From
Jeff Davis
Date:
On Wed, 2006-08-23 at 16:04 -0700, Frank Cohen wrote:
> I'm doing a performance and scalability test project for a PostgreSQL
> user who is working with geospatial data. The data is in GML form.
> For instance:
>
>
> <watch version="9" id="flight" time="2006-08-16T10:16:36.125-07:00">
> <point latitude="7" longitude="55"/>
> <detail>
>    <gml:Point xmlns:gml="http://www.opengis.net/gml">
>      <gml:coordinates>7.0,9.0</gml:coordinates>
>    </gml:Point>
> </detail>
> </watch>
>
>
> I installed PostGIS and it supports Point and coordinates very well.
>
> I an not sure what I should do with the XML content using PostgreSQL?
> For example,
>
> 1) Tom Dyson at http://www.throwingbeans.org/
> postgresql_and_xml_updated.html says "PostgreSQL 8 ships with
> xpath_table to evaluate a set of XPath queries and returns the
> results as a virtual table."
>
> These look like good XPath functions. Are they actually in PSQL
> 8.1.4? I did not find them in the Windows installed version. If not,
> are they recommended?

Look at contrib/xml2. The function xpath_table is in that module. I'm
not familiar enough with windows to tell you how to install it, but
hopefully this gives you a good starting point.

Regards,
    Jeff Davis


Re: XPath and XML support

From
"Nikolay Samokhvalov"
Date:
On 8/24/06, Jeff Davis <pgsql@j-davis.com> wrote:
> On Wed, 2006-08-23 at 16:04 -0700, Frank Cohen wrote:
> >
> > These look like good XPath functions. Are they actually in PSQL
> > 8.1.4? I did not find them in the Windows installed version. If not,
> > are they recommended?
>
> Look at contrib/xml2. The function xpath_table is in that module. I'm
> not familiar enough with windows to tell you how to install it, but
> hopefully this gives you a good starting point.
>

AFAIK, contrib/xml2 hasn't been ported to Windows yet (at least, this
is in the current TODO list).

--
Best regards,
Nikolay

Re: XPath and XML support

From
Frank Cohen
Date:
Thanks Nikolay: Seeing as xml2 hasn't been ported to Windows yet
makes me wonder if this is going to be the best way to use XML in
PostgreSQL in the long-term? Is there anything else on the boards? -
Frank



On Aug 24, 2006, at 4:17 AM, Nikolay Samokhvalov wrote:

> On 8/24/06, Jeff Davis <pgsql@j-davis.com> wrote:
>> On Wed, 2006-08-23 at 16:04 -0700, Frank Cohen wrote:
>> >
>> > These look like good XPath functions. Are they actually in PSQL
>> > 8.1.4? I did not find them in the Windows installed version. If
>> not,
>> > are they recommended?
>>
>> Look at contrib/xml2. The function xpath_table is in that module. I'm
>> not familiar enough with windows to tell you how to install it, but
>> hopefully this gives you a good starting point.
>>
>
> AFAIK, contrib/xml2 hasn't been ported to Windows yet (at least, this
> is in the current TODO list).
>
> --
>
> Best regards,
> Nikolay
>


Re: XPath and XML support

From
John Gray
Date:
On Thu, 24 Aug 2006 13:56:12 -0700, Frank Cohen wrote:

> Thanks Nikolay: Seeing as xml2 hasn't been ported to Windows yet
> makes me wonder if this is going to be the best way to use XML in
> PostgreSQL in the long-term? Is there anything else on the boards? -
> Frank
>

There's a lot of scope to do better than the current support, certainly.

However, the "not ported to Windows" is slightly misleading - the code
(like a lot of contrib code) compiles fine under Windows. Because of the
dependency on libxml2, it might not often be distributed as a binary, but
people are definitely using on Win32 (I'm not really a Win32 user but I
have tried it and it did work).

John




Re: XPath and XML support

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org] On Behalf Of John Gray
> Sent: 29 August 2006 22:49
> To: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] XPath and XML support
>
> On Thu, 24 Aug 2006 13:56:12 -0700, Frank Cohen wrote:
>
> > Thanks Nikolay: Seeing as xml2 hasn't been ported to Windows yet
> > makes me wonder if this is going to be the best way to use XML in
> > PostgreSQL in the long-term? Is there anything else on the
> boards? -
> > Frank
> >
>
> There's a lot of scope to do better than the current support,
> certainly.
>
> However, the "not ported to Windows" is slightly misleading - the code
> (like a lot of contrib code) compiles fine under Windows.
> Because of the
> dependency on libxml2, it might not often be distributed as a
> binary, but
> people are definitely using on Win32 (I'm not really a Win32
> user but I
> have tried it and it did work).

It was only ported relatively recently (I know, I did it). It will ship
with the Windows PostgreSQL 8.2 binary installer.

Regards, Dave.