こんばんは、
My Pebble Watch プロジェクトが進化し、公式の外部 API を使用して HTTP リクエストを作成して値を取得するようになりました。以前の質問は JSON に関するものでしたが、現在は結果を XML 形式で取得しています。
API を呼び出したときに取得する XML は次のとおりです。
<?xml version="1.0" encoding="UTF-8"?>
<root>
<items>
<item id="1234567">
<author gender="man" country="France" region="Ile-de-France">myuser</author>
<category>mycategory</category>
<date>2010-08-23T05:48:51+02:00</date>
<from />
<text>THIS IS THE CONTENT</text>
<comments_flag>1</comments_flag>
<short_url>http://myshort.url</short_url>
</item>
</items>
<comments />
<active_key>1234567890</active_key>
<code>1</code>
<pubdate>2014-07-12T18:51:49+02:00</pubdate>
<language>fr</language>
<errors />
</root>
そして、これは私が現在SimplyJSスクリプトに持っているものです:
simply.on('accelTap' || 'singleClick', function(e) {
simply.body("Loading...");
ajax({ url: 'http://myAPIurl', type:'xml' }, function(data){
simply.scrollable(true);
simply.body(data);
});
//}
});
その結果、完全な XML が Pebble に表示されます。しかし、 < text >セクションの下のコンテンツのみを取得したいと思います。
JSON のような「data.text」セレクターを試してみましたが、オブジェクト エラーが発生します。
ありがとうございました !