Yahoo Query Language と YQL が提供する xpath 機能を使用して html を解析しようとすると、「text()」または属性値を抽出できないという問題に遭遇しました。パーマリンク
など
select * from html where url="http://stackoverflow.com"
and xpath='//div/h3/a'
アンカーのリストを xml として与える
<results>
<a class="question-hyperlink" href="/questions/661184/filling-the-text-area-with-the-text-when-a-button-is-clicked" title="In ASP.net, I need the code to fill the text area (in the form) when a button is clicked. Can you help me through by showing a simple .aspx code containing the script tag? ">Filling the text area with the text when a button is clicked</a>...
</results>
を使用してノード値を抽出しようとすると
select * from html where url="http://stackoverflow.com"
and xpath='//div/h3/a/text()'
ノードリストではなく連結された結果を取得します。
<results>Xcode: attaching to a remote process for debuggingWhy is b
…… </results>
それをノード リストに分割する方法と、属性値を選択する方法を教えてください。
このようなクエリ
select * from html where url="http://stackoverflow.com"
and xpath='//div/h3/a[@href]'
クエリで同じ結果が得られましたdiv/h3/a