Re: xpath processing brain dead - Mailing list pgsql-hackers
From | Andrew Dunstan |
---|---|
Subject | Re: xpath processing brain dead |
Date | |
Msg-id | 49AB18C6.80508@dunslane.net Whole thread Raw |
In response to | Re: xpath processing brain dead (Hannu Krosing <hannu@2ndQuadrant.com>) |
Responses |
Re: xpath processing brain dead
|
List | pgsql-hackers |
Hannu Krosing wrote: > On Sun, 2009-03-01 at 10:13 -0500, Andrew Dunstan wrote: > >> Hannu Krosing wrote: >> >>>> Some of the functions, including some specified in the standard, produce >>>> fragments. That's why we have the 'IS DOCUMENT' test. >>>> >>>> >>> But then you could use xmlfragments as the functions return type, no ? >>> >>> Does tha standard require that the same field type must store both >>> documents and fragments ? >>> >>> >>> >> Yes, the standard very explicitly provides for one XML type which need >> not be an XML document. We have no choice about that. >> > > What is it then ? A sequence of XML elements ? > In its typically oblique way, the 2003 draft says this: NOTE 1 — An XML root information item is similar to an XML document information item, with the following modifications:an XML root information item does not have a [document element] property, a [base URI] property, a [characterencoding scheme] property, or an [all declarations processed] property; and the [children] property permitsmore than one XML element information item. An SQL/XML information item is either an XML root information item or one of the following (defined in Subclause 3.1.3,“Definitions provided in Part 14”): an XML attribute information item, an XML character information item, an XMLcomment information item, an XML document type declaration information item, an XML element information item, an XMLnamespace information item, an XML notation information item, an XML processing instruction information item, an XMLunexpanded entity reference information item, or an XML unparsed entity information item. An XML value is either the null value, or a collection of SQL/XML information items, consisting of exactly one XMLroot information item, plus any other SQL/XML information items that can be reached recursively by traversing theproperties of the SQL/XML information items. > Which standard does postgreSQL XML type need to confirm to - general XML > DB, Xpath or some other XML ? > I think the XML type needs to conform to the SQL/XML spec. However, we are trying to apply XPath, which has a different data model, to that type - hence the impedance mismatch. I think that the best we can do (for 8.4, having fixed 8.3 as best we can without adversely changing behaviour) is to throw the responsibility for ensuring that the XML passed to the function is an XML document back on the programmer. Anything else, especially any mangling of the XPath expression, presents a very real danger of breaking on correct input. cheers andrew
pgsql-hackers by date: