Re: Issue: Deprecation of the XML2 module 'xml_is_well_formed' function
От | Mike Fowler |
---|---|
Тема | Re: Issue: Deprecation of the XML2 module 'xml_is_well_formed' function |
Дата | |
Msg-id | 20100701172553.w5vdy1xbocos8g40@www.mlfowler.com обсуждение исходный текст |
Ответ на | Re: Issue: Deprecation of the XML2 module 'xml_is_well_formed' function (Mike Fowler <mike@mlfowler.com>) |
Ответы |
Re: Issue: Deprecation of the XML2 module
'xml_is_well_formed' function
|
Список | pgsql-hackers |
Quoting Mike Fowler <mike@mlfowler.com>: > Should the IS DOCUMENT predicate support this? At the moment you get > the following: > > template1=# SELECT > '<towns><town>Bidford-on-Avon</town><town>Cwmbran</town><town>Bristol</town></towns>' > IS > DOCUMENT; > ?column? > ---------- > t > (1 row) > > template1=# SELECT > '<towns><town>Bidford-on-Avon</town><town>Cwmbran</town><town>Bristol</town></towns' > IS > DOCUMENT; > ERROR: invalid XML content > LINE 1: SELECT '<towns><town>Bidford-on-Avon</town><town>Cwmbran</to... > ^ > DETAIL: Entity: line 1: parser error : expected '>' > owns><town>Bidford-on-Avon</town><town>Cwmbran</town><town>Bristol</town></towns > > ^ > Entity: line 1: parser error : chunk is not well balanced > owns><town>Bidford-on-Avon</town><town>Cwmbran</town><town>Bristol</town></towns > > ^ > I would've hoped the second would've returned 'f' rather than failing. > I've had a glance at the XML/SQL standard and I don't see anything in > the detail of the predicate (8.2) that would specifically prohibit us > from changing this behavior, unless the common rule 'Parsing a string > as an XML value' (10.16) must always be in force. I'm no standard > expert, but IMHO this would be an acceptable change to improve > usability. What do others think? Right, I've answered my own question whilst sitting in the open source coding session at CHAR(10). Yes, IS DOCUMENT should return false for a non-well formed document, and indeed is coded to do such. However, the conversion to the xml type which happens before the underlying xml_is_document function is even called fails and exceptions out. I'll work on a patch to resolve this behavior such that IS DOCUMENT will give you the missing 'xml_is_well_formed' function. Regards, -- Mike Fowler Registered Linux user: 379787
В списке pgsql-hackers по дате отправления: