質問

I use xpath library. I use this instruction to select any table in DOM, but i get only the first table. For example:

load_structure('C:/example.html', DOM, []) 
xpath(DOM, //table, TB)

In example.html there are several tables, but i get only the first table. Why? How can i do to get all tables in the HTML page?

役に立ちましたか?

解決

try

...,
load_structure('C:/example.html', DOM, []) 
forall(xpath(DOM, //table, TB), use_table(TB)),
...

use_table/1 should not fail, or the entire loop will fail as well.

edit: to collect all tables:

findall(TB, xpath(DOM, //table, TB), Tables)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top