Re: XPATH evaluation

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: Florian Pflug <fgp(at)phlo(dot)org>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: XPATH evaluation
Date: 2011-06-17 15:03:23
Message-ID: 201106171703.24290.rsmogura@softperience.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Florian Pflug <fgp(at)phlo(dot)org> Friday 17 of June 2011 11:41:08
> On Jun17, 2011, at 11:09 , Radosław Smogura wrote:
> > 1.
> > SELECT (XPATH('/root/*', '<root xmlns:o="http://olacle.com/db"
> > xmlns:p="http://postgresql.org/db"><o:db><a><b></b></a></o:db><p:db></p:
> > db></root>')); Produces:
> > "{"<o:db>
> >
> > <a>
> >
> > <b/>
> >
> > </a>
> >
> > </o:db>",<p:db/>}"
> > In above <b></b> was reduced to <b/> this is different infoset then
> > input, and those notations are differently interpreted e.g. by XML
> > Binding & WebServices. The 1st one will may be mapped to empty string,
> > and 2nd one to to null.
>
> Oh, joy :-(
>
> Does this happen only with my patch applied or also with unpatched HEAD?
>
> > 2.
> > SELECT (XPATH('/root/*', '<root xmlns:o="http://olacle.com/db"
> > xmlns:p="http://postgresql.org/db"><o:db></o:db><p:db></p:db></root>'));
> > "{<o:db/>,<p:db/>}"
> > In above I missing namespaces.
>
> Hm, that's a hard problem a think. Your problem (1) basically tells us that
> ideally we'd return the matching parts of an XML document unmodified. Now,
> (2) tells us that isn't to most sensible thing to do either.
>
> > I may take on assignment 1st (fix is simple)
>
> Whats your proposed fix for (1)?
>
> > , but for 2nd I have mixed fillings. I think 2nd should transfer
> > namespaces in some way to client.
>
> I don't see how XPATH() can do that without breaking it's API. The only
> thing we could do AFAICS is the define a second XPATH evaluation function
> which returns a list of namespace declarations (prefix and uri) for every
> node.
>
> best regards,
> Florian Pflug

No this is not about Your patch, but was inspired by it.
Regards,
Radek

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2011-06-17 15:09:25 Re: XPATH evaluation
Previous Message Jaime Casanova 2011-06-17 14:57:13 Re: [v9.2] Start new timeline for PITR