Re: xpath_array with namespaces support
От | Peter Eisentraut |
---|---|
Тема | Re: xpath_array with namespaces support |
Дата | |
Msg-id | 200704041544.43371.peter_e@gmx.net обсуждение исходный текст |
Ответ на | Re: xpath_array with namespaces support (Bruce Momjian <bruce@momjian.us>) |
Список | pgsql-patches |
Am Mittwoch, 4. April 2007 15:20 schrieb Nikolay Samokhvalov: > > To determine if an XML datum is a document, call xml_is_document(). The > > implementation of that function is probably not the best possible one, > > but what the xpath() code does it totally wrong nevertheless. > > You are proposing 2-3 (depends on the case) parsing times for the one XML > value instead of current 1-2 I know it's bad, and something like adding a bit (byte) to mark this in the value would be good, but that doesn't change the fact that (xmlStrncmp((xmlChar *) VARDATA(data), (xmlChar *) "<?xml", 5) == 0) is not a valid method to tell apart a document from a fragment. Proof: pei=# select xml '<?xml version="1.0"?><foo>bar</foo>' IS DOCUMENT; ?column? ---------- t (1 row) pei=# select xml '<?xml version="1.0"?><foo>bar</foo><foo>bar</foo>' IS DOCUMENT; ?column? ---------- f (1 row) pei=# select xml '<foo>bar</foo>' IS DOCUMENT; ?column? ---------- t (1 row) pei=# select xml '<foo>bar</foo><foo>bar</foo>' IS DOCUMENT; ?column? ---------- f (1 row) -- Peter Eisentraut http://developer.postgresql.org/~petere/
В списке pgsql-patches по дате отправления: