Skip site navigation (1) Skip section navigation (2)

Re: [PATCHES] xml2 contrib patch supporting default XML namespaces

From: "Mike Rylander" <mrylander(at)gmail(dot)com>
To: nikolay(at)samokhvalov(dot)com
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCHES] xml2 contrib patch supporting default XML namespaces
Date: 2007-03-06 13:08:01
Message-ID: b918cf3d0703060508q4585c1aehb1aa24423b63d8cb@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
On 3/6/07, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com> wrote:
> On 3/6/07, Mike Rylander <mrylander(at)gmail(dot)com> wrote:
> > Attatched you'll find a patch that I've been kicking around for a
> > while that I'd like to propose for inclusion in 8.3.  I attempted to
> > submit this through the original xml2 author (as far back as the  7.4
> > days) but got no response.
> >
> > It's really fairly trivial, but I will be using the features it
> > provides in production soon, so I'd like to see it applied against the
> > contrib xml2 module.  The patch adds support for default XML
> > namespaces in xml2 by providing a mechanism for supplying a prefix to
> > a named namespace URI.  It then wraps the namespace-capable functions
> > in backward-compatible equivalents so that old code will not break.
>
> 1) And what about non-default namespaces?

I'm not sure I understand.  If the namespace already has a prefix then
it works fine.  This patch simply gives a known non-prefixed namespace
URI a prefix so one can write XPath that looks like

  //marc:datafield[(at)tag='245']/marc:subfied[(at)code='a']

instead of

  //*[local-name()='datafield' and
@tag='245']/*[local-name()='subfied' and @code='a']

A little two node example is painful enough, now imagine a non-trivial
example with backtracking conditionals... :P

> 2) What if my XPath query has different prefix, that also should be
> mapped to the same URI? (Not frequent case, but this really can occur
> -- e.g. XML doc has prefix 'local' for URI='http://127.0.0.1', but
> XPath should have 'loc' for the same URI.)
>

Both prefixes work fine as multiple prefixes can map to the same URI.

> --
> Best regards,
> Nikolay
>


-- 
Mike Rylander
mrylander(at)gmail(dot)com
GPLS -- PINES Development
Database Developer
http://open-ils.org

In response to

pgsql-hackers by date

Next:From: Gregory StarkDate: 2007-03-06 13:57:56
Subject: Re: Auto creation of Partitions
Previous:From: NikhilSDate: 2007-03-06 13:01:41
Subject: Re: Auto creation of Partitions

pgsql-patches by date

Next:From: Gregory StarkDate: 2007-03-06 13:57:56
Subject: Re: Auto creation of Partitions
Previous:From: NikhilSDate: 2007-03-06 13:01:41
Subject: Re: Auto creation of Partitions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group