Date: prev next · Thread: first prev next last


matuakiです。

このサービスが出しているXMLをFILTERXML関数が理解できていないみたいです。

=WEBSERVICE("http://www.finds.jp/ws/geocode.php?mcode=27127";)
で取得したXMLで

<geocode xmlns="http://finds.jp/ts";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

の部分を

<geocode>

に変更するとFILTERXML関数は値を読み込みました。
(式は=FILTERXML(A1,"//geocode/result/latitude")に変えましたが)

この現象が、XMLを出している側の問題かCalcの関数の方に問題があるのか、わ
たしはよく分かりません。

参考までに。

(2014年06月20日 19:10), Jun NOGATA wrote:
こんにちは。野方です。

LibreOffice 4.2から入ったCalcのWEBSERVICE関数を使って、Web APIにアクセ
スして、返ってきたXMLからFILTERXML関数を使って値を取り出そうとしていま
すが、うまく取り出すことができません。

使っているWeb APIは、こちらです。

- 簡易ジオコーディングサービス / Finds.jp Webサービス: http://www.finds.jp/wsdocs/geocode/

市町村コードを指定してアクセスすると緯度経度がXMLで返ってきます。
大阪市北区(27127)なら、こんな感じでアクセスすると緯度経度が返ってきます。

- http://www.finds.jp/ws/geocode.php?mcode=27127

試しにA1セルとA2セルに

A1セル =WEBSERVICE("http://www.finds.jp/ws/geocode.php?mcode=27127";)
A2セル =FILTERXML(A1,"//latitude")

と書いて試しましたが、#VALUEエラーになってしまいます。

XPathをあまり理解していないので書き方が悪いのかと思い、Livedoorのお天気
RSSを使って試したところ

- http://weather.livedoor.com/forecast/rss/area/270000.xml

A1セル =WEBSERVICE("http://weather.livedoor.com/forecast/rss/area/270000.xml";)
A2セル =FILTERXML(A1,"//item[3]/title")

こちらは、うまくtitle要素の値を取り出すことができました。

ちょっと、よくわからなくなってきたのですが、FILTERXMLのXpathをどういう
風な書き方をすると値を取り出すことができるのでしょうか。
「これを見ろー」でもいいので、なにか情報ありましたら教えてください。



-- 
-------------------------------------------------
matuaki
matuaki_at_ma-office.org
http://openoffice.sblo.jp/

-- 
Unsubscribe instructions: E-mail to users+unsubscribe@ja.libreoffice.org
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/ja/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.