1
我無法使css-selectors:query
正常工作。 完全不明白什麼參數以什麼順序進入。 http://quickdocs.org/css-selectors/使用css-selectors查找節點:查詢
查看源代碼:
(defun query (inp &optional (trees buildnode:*document*))
"Given a css selector, attempt to find the matching nodes in the passed in
dom-trees (defaults to the document)"
(%query inp trees))
我不知道inp
代表什麼,但通過排除法假定它是指一個CSS選擇器字符串。
(defun get-page (url)
"Get STP(DOM alternative) representation of page"
(chtml:parse
(drakma:http-request url)
(cxml-stp:make-builder)))
(css-selectors:query "a" (get-page "http://lisp.org/")) ; Doesn't work
(css-selectors:query (get-page "http://lisp.org/") "a") ; Worth a try
示例使用會大大有所幫助。