xquery for a
tag contents

2019-08-24 02:20发布

问题:

From within the basex GUI how do I now query the database for book categories? The xpath is something like:

//div[@class='side_categories']/ul/li/ul

More specifically, what's the xquery to grab the contents within the div tag of side_categories for the database?

the database:

(fetching and loading the database)

code:

thufir@dur:~/basex$ 
thufir@dur:~/basex$ cat html_fetch_parse.xq 


fetch:xml("http://books.toscrape.com/", map {
  'parser': 'html',
  'htmlparser': map { 'html': false(), 'nodefaults': true() }
})

thufir@dur:~/basex$ 

Specifically, I'm after the list items, categories, specified by side_categories with a div tag:

Looking to chain or pipe files and output with another xq file.

Basic query:

thufir@dur:~/basex$ 
thufir@dur:~/basex$ cat db_query.xq 


let $db := db:open("html_fetch_parse")
return $db


thufir@dur:~/basex$ 

But that just connects to the database. How do I extract a div specific div tag?