Re: [PATCHES] xml2 contrib patch supporting default XML namespaces
От | Mike Rylander |
---|---|
Тема | Re: [PATCHES] xml2 contrib patch supporting default XML namespaces |
Дата | |
Msg-id | b918cf3d0703060508q4585c1aehb1aa24423b63d8cb@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCHES] xml2 contrib patch supporting default XML namespaces ("Nikolay Samokhvalov" <samokhvalov@gmail.com>) |
Список | pgsql-hackers |
On 3/6/07, Nikolay Samokhvalov <samokhvalov@gmail.com> wrote: > On 3/6/07, Mike Rylander <mrylander@gmail.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[@tag='245']/marc:subfied[@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@gmail.com GPLS -- PINES Development Database Developer http://open-ils.org
В списке pgsql-hackers по дате отправления: