[plexippus-xpath-devel] Beginner: trying out xpath

Andrei Stebakov lispercat at gmail.com
Fri Nov 26 23:48:16 UTC 2010


Just tired to evaluate

(let ((doc (chtml:parse (drakma:http-request "http://www.google.com")
                        (stp:make-builder))))
  (xpath:evaluate "//body" doc))

This results in an exception:
The value NIL is not of type VECTOR.
   [Condition of type TYPE-ERROR]

Restarts:
 0: [RETRY] Retry SLIME interactive evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [TERMINATE-THREAD] Terminate this thread (#<THREAD "worker"
RUNNING {C499B91}>)

Backtrace:
  0: (CXML-STP-IMPL::NORMALIZE-TEXT-NODES! ..)
  1: ((SB-PCL::FAST-METHOD XPATH-PROTOCOL:CHILD-PIPE-USING-NAVIGATOR
((EQL :DEFAULT-NAVIGATOR) CXML-STP:ELEMENT)) ..)
  2: ((LAMBDA (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0.
SB-PCL::.ARG1.)) ..)
  3: ((LAMBDA (XPATH::NODE XPATH::STARTING-NODE)) ..)
  4: ((LAMBDA (XPATH::N)) ..)
  5: (XPATH::MAPPEND-PIPE ..)
  6: (XPATH::MAPPEND-PIPE ..)
  7: (XPATH::MAPPEND-PIPE ..)
  8: (XPATH::MAPPEND-PIPE ..)
  9: ((LAMBDA (XPATH::NODE XPATH::STARTING-NODE)) ..)
 10: ((LAMBDA (XPATH::N)) #.(CXML-STP-IMPL::DOCUMENT :CHILDREN
'(#.(CXML-STP:ELEMENT #| :PARENT of type DOCUMENT |# :CHILDREN '#
:LOCAL-NAME "html" :NAMESPACE-URI "http://www.w3.org/1999/xhtml"))))
 11: (XPATH::MAPPEND-PIPE ..)
 12: ((LAMBDA (XPATH::NODE XPATH::STARTING-NODE)) ..)
 13: ((LAMBDA (XPATH:CONTEXT)) #<XPATH:CONTEXT {DA0EA59}>)
 14: (XPATH:EVALUATE-COMPILED ..)


When evaluating "body" (without //) just returns an empty set.

Got the latest xpath, cxml-stp, closure-html.
What am I missing? Parsing html, should I use  (stp:do-recursively
...) instead for better results?

Thank you,
Andrew




More information about the plexippus-xpath-devel mailing list