rfc: changing documentation about xpath
Hi!
I'm to face a problem, and not at once resolve it. When I do:
-- // --
test=# SELECT xpath('//domain:name/text()',
$$<?xml version='1.0' encoding='UTF-8'?>
<epp xmlns='urn:ietf:params:xml:ns:epp-1.0'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd'>
<response>
<result code='1301'>
<msg lang='en-US'>Command completed successfully; ack to dequeue</msg>
</result>
<msgQ count='3' id='114004'>
<qDate>2010-06-02T12:35:33.0Z</qDate>
<msg lang='en-US'>Transfer Requested.</msg>
</msgQ>
<resData>
<domain:trnData
xmlns:domain='urn:ietf:params:xml:ns:domain-1.0'
xsi:schemaLocation='urn:ietf:params:xml:ns:domain-1.0
domain-1.0.xsd'>
<domain:name>xxx.xx</domain:name>
<domain:trStatus>pending</domain:trStatus>
<domain:reID>admin</domain:reID>
<domain:reDate>2010-06-02T12:35:33.0Z</domain:reDate>
<domain:acID>xxx-xx</domain:acID>
<domain:acDate>2010-06-07T12:35:33.0Z</domain:acDate>
<domain:exDate>2014-05-11T12:52:07.0Z</domain:exDate>
</domain:trnData>
</resData>
<trID>
<svTRID>xx-xxx</svTRID>
</trID>
</response>
</epp>$$,
array[array['domain','urn:ietf:params:xml:ns:domain-1.0']]);
xpath
-------------
{xxx.xx}
(1 row)
test=#
-- // --
worked... and:
-- // --
test=# SELECT xpath('//qDate/text()',
$$<?xml version='1.0' encoding='UTF-8'?>
<epp xmlns='urn:ietf:params:xml:ns:epp-1.0'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd'>
<response>
<result code='1301'>
<msg lang='en-US'>Command completed successfully; ack to dequeue</msg>
</result>
<msgQ count='3' id='114004'>
<qDate>2010-06-02T12:35:33.0Z</qDate>
<msg lang='en-US'>Transfer Requested.</msg>
</msgQ>
<resData>
<domain:trnData
xmlns:domain='urn:ietf:params:xml:ns:domain-1.0'
xsi:schemaLocation='urn:ietf:params:xml:ns:domain-1.0
domain-1.0.xsd'>
<domain:name>xxx.xx</domain:name>
<domain:trStatus>pending</domain:trStatus>
<domain:reID>admin</domain:reID>
<domain:reDate>2010-06-02T12:35:33.0Z</domain:reDate>
<domain:acID>xxx-xx</domain:acID>
<domain:acDate>2010-06-07T12:35:33.0Z</domain:acDate>
<domain:exDate>2014-05-11T12:52:07.0Z</domain:exDate>
</domain:trnData>
</resData>
<trID>
<svTRID>xx-xxx</svTRID>
</trID>
</response>
</epp>$$);
xpath
-------
{}
(1 row)
test=#
-- // --
not worked.
I think that the nuance about default namespaces should add to xpath's doc.
This select:
-- // --
SELECT xpath('//global:qDate/text()',
$$<?xml version='1.0' encoding='UTF-8'?>
<epp xmlns='urn:ietf:params:xml:ns:epp-1.0'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd'>
<response>
<result code='1301'>
<msg lang='en-US'>Command completed successfully; ack to dequeue</msg>
</result>
<msgQ count='3' id='114004'>
<qDate>2010-06-02T12:35:33.0Z</qDate>
<msg lang='en-US'>Transfer Requested.</msg>
</msgQ>
<resData>
<domain:trnData
xmlns:domain='urn:ietf:params:xml:ns:domain-1.0'
xsi:schemaLocation='urn:ietf:params:xml:ns:domain-1.0
domain-1.0.xsd'>
<domain:name>xxx.xx</domain:name>
<domain:trStatus>pending</domain:trStatus>
<domain:reID>admin</domain:reID>
<domain:reDate>2010-06-02T12:35:33.0Z</domain:reDate>
<domain:acID>xxx-xx</domain:acID>
<domain:acDate>2010-06-07T12:35:33.0Z</domain:acDate>
<domain:exDate>2014-05-11T12:52:07.0Z</domain:exDate>
</domain:trnData>
</resData>
<trID>
<svTRID>xx-xxx</svTRID>
</trID>
</response>
</epp>$$, array[array['global', 'urn:ietf:params:xml:ns:epp-1.0']]);
xpath
--------------------------
{2010-06-02T12:35:33.0Z}
(1 row)
-- // --
work. Thanks to Ёж on www.sql.ru and pgsql-ru-general ... :)
--
Best regards,
Denis I. Polukarov
developer
"Garant-Park-Telekom"
http://www.gpt.ru
Denis I. Polukarov wrote:
Hi!
I'm to face a problem, and not at once resolve it.
[default namespace mapped in xml "xmlns=" attribute requires
corresponding mapping in third param of xpath()]
It's a tolerably subtle point, and I'm not sure it's really
PostgreSQL-specific. But if you think the docs need improvement, then
please suggest a patch with the extra wording you think would make
things clearer.
cheers
andrew
On Thu, Jun 3, 2010 at 16:02, Andrew Dunstan <andrew@dunslane.net> wrote:
Denis I. Polukarov wrote:
Hi!
I'm to face a problem, and not at once resolve it.
[default namespace mapped in xml "xmlns=" attribute requires corresponding
mapping in third param of xpath()]It's a tolerably subtle point, and I'm not sure it's really
PostgreSQL-specific. But if you think the docs need improvement, then please
suggest a patch with the extra wording you think would make things clearer.
You are absolutely right, it's not really Postgres-specific, it's XML
specific, but every novice using xpath encounters with this unclear point.
So, small docs patch is sent to -docs.