I’m trying to use xml/path (https://docs.racket-lang.org/xml/index.html#%28mod-path._xml%2Fpath%29) to access data in an xexpr, but I can’t find out the valid syntax for an se-path in se-path*/list. Specifically, I want to find a div that has a class="description". Any ideas?
I don’t know if it is helpful or not, but here are some results from Github: https://github.com/search?q=%22se-path*%22&type=code
I think if you really want to use this, you would query to find all '(div), and filter for those with the desired class.
It’s called “Simple X-expression Path Queries” for a reason :slightly_smiling_face:
> find all '(div), and filter for those with the desired class. Yes, that could be a workaround I thought of.
By the way, there’s also https://docs.racket-lang.org/xexpr-path/index.html#%28def._%28%28lib._xexpr-path%2Fmain..rkt%29._xexpr-path-list%29%29 , but I couldn’t get this to work either.
Even (xexpr-path-list '(div) e2) (where e2 is my document) returns an empty list, though the document has plenty of divs in it. But since the example for xexpr-path-list (xexpr-path-list '(greeting)
'(greetings (greeting "Hello World!")
(greeting "Ahoj Světe!"))) works, I suspect you have to provide the full “tail” of the path (i.e. further down than just the div).
oh yeah
I think it would, but if that’s infeasible it should definitely emit a warning of some kind