xmlns in xpath query
От | Frank Glandorf |
---|---|
Тема | xmlns in xpath query |
Дата | |
Msg-id | ec29055e0909181913g3cc77d6ej51ba155be128d003@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: xmlns in xpath query
|
Список | pgsql-novice |
Using postgresql v8.3 and xml xpath query function and having trouble with xmlns. Note: the select statements were originally all on a single line.
The xpath function works ok if the xmlns attributes are missing.
select xpath('/gpx', '<gpx version="1.0" creator="GPSBabel - http://www.gpsbabel.org">abc</gpx>');
xpath
-----------------------------------------------------------------------------------
{"<gpx version=\"1.0\" creator=\"GPSBabel - http://www.gpsbabel.org\">abc</gpx>"}
(1 row)
The xpath function gives no result when xmlns attributes are supplied.
select xpath('/gpx', '<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0" version="1.0" creator="GPSBabel - http://www.gpsbabel.org" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">abc</gpx>');
xpath
-------
{}
(1 row)
Setting the optional name space attributes for the xpath function also gives no results.
select xpath('/gpx', '<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0" version="1.0" creator="GPSBabel - http://www.gpsbabel.org" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">abc</gpx>', array[array['xsi','http://www.w3.org/2001/XMLSchema-instance'],array['','http://www.topografix.com/GPX/1/0']]);
xpath
-------
{}
(1 row)
Suggestions?
-Frank
The xpath function works ok if the xmlns attributes are missing.
select xpath('/gpx', '<gpx version="1.0" creator="GPSBabel - http://www.gpsbabel.org">abc</gpx>');
xpath
-----------------------------------------------------------------------------------
{"<gpx version=\"1.0\" creator=\"GPSBabel - http://www.gpsbabel.org\">abc</gpx>"}
(1 row)
The xpath function gives no result when xmlns attributes are supplied.
select xpath('/gpx', '<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0" version="1.0" creator="GPSBabel - http://www.gpsbabel.org" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">abc</gpx>');
xpath
-------
{}
(1 row)
Setting the optional name space attributes for the xpath function also gives no results.
select xpath('/gpx', '<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0" version="1.0" creator="GPSBabel - http://www.gpsbabel.org" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">abc</gpx>', array[array['xsi','http://www.w3.org/2001/XMLSchema-instance'],array['','http://www.topografix.com/GPX/1/0']]);
xpath
-------
{}
(1 row)
Suggestions?
-Frank
В списке pgsql-novice по дате отправления: