En essayant d'analyser html en utilisant Yahoo Query Language et xpath fonctionnalité fournie par YQL, j'ai rencontré des problèmes de ne pas être en mesure d'extraire "text()" ou des valeurs d'attribut.
Par exemple.
perma linkQuerying html en utilisant Yahoo YQL
select * from html where url="http://stackoverflow.com"
and xpath='//div/h3/a'
donne une liste des points d'ancrage au format XML
<results>
<a class="question-hyperlink" href="https://stackoverflow.com/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>
Maintenant, lorsque je tente d'extraire la valeur de nœud à l'aide
select * from html where url="http://stackoverflow.com"
and xpath='//div/h3/a/text()'
j'obtenir des résultats concaténés plutôt qu'une liste des nœuds
<results>Xcode: attaching to a remote process for debuggingWhy is b
…… </results>
Comment puis-je séparer en listes de noeuds et comment sélectionner des valeurs attribut?
Une requête comme celui-ci
select * from html where url="http://stackoverflow.com"
and xpath='//div/h3/a[@href]'
m'a donné les mêmes résultats pour effectuer des requêtes div/h3/a
Fonctionne comme un charme! – Cherian