[plexippus-xpath-devel] error with expression pointing to nonexistent child node

David A. Thompson thompdump at gmail.com
Fri Sep 17 20:17:00 UTC 2010


On 09/17/2010 12:06 AM, Ivan Shvedunov wrote:
> Hello,
>
> On Fri, Sep 17, 2010 at 3:28 AM, David A. Thompson<thompdump at gmail.com>  wrote:
>> Depending on the xpath expression, when a match isn't found, either an
>> empty node-set is returned or an error occurs. Is this deliberate?
>>
>> 1. Match works as expected:
>>
>> TTEST>  (xpath:evaluate "/etx" (cxml:parse "<etx></etx>" (stp:make-builder)))
>>
>> #<XPATH:NODE-SET #.(ELEMENT LOCAL-NAME etx), ... {C9378D9}>
>>
>>
>> 2. Evaluation of this xpath expression yields an empty node set:
>>
>> TTEST>  (xpath:evaluate "/foo" (cxml:parse "<etx></etx>" (stp:make-builder)))
>>
>> #<XPATH:NODE-SET empty {CA0A879}>
>>
>>
>> 3. Evaluation of this xpath expression triggers an error:
>>
>> TTEST>  (xpath:evaluate "//foo" (cxml:parse "<etx></etx>"
>> (stp:make-builder)))
>>
>
> No, it should not signal an error when a match isn't found.
> Which CL implementation are you using? (looks like SBCL?)
> I cannot reproduce this problem, what does the backtrace look like?
>

Ivan,

Thanks for the quick response. I'm using SBCL 1.0.39.

SBCL's complaint:

The value NIL is not of type VECTOR.
    [Condition of type TYPE-ERROR]

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

Backtrace:
   0: (CXML-STP-IMPL::NORMALIZE-TEXT-NODES! #.(CXML-STP:ELEMENT #| 
:PARENT of type DOCUMENT |# :LOCAL-NAME "etx"))
   1: ((SB-PCL::FAST-METHOD XPATH-PROTOCOL:CHILD-PIPE-USING-NAVIGATOR 
((EQL :DEFAULT-NAVIGATOR) CXML-STP:ELEMENT)) ..)
   2: ((LAMBDA (XPATH::NODE XPATH::STARTING-NODE)) ..)
   3: ((LAMBDA (XPATH::N)) #.(CXML-STP:ELEMENT #| :PARENT of type 
DOCUMENT |# :LOCAL-NAME "etx"))
   4: (XPATH::MAPPEND-PIPE #<CLOSURE (LAMBDA #) {C2B8425}> 
(#.(CXML-STP:ELEMENT #| :PARENT of type DOCUMENT |# :LOCAL-NAME "etx") . 
#<CLOSURE # {C2B84FD}>))
   5: (XPATH::MAPPEND-PIPE #<CLOSURE (LAMBDA #) {C2B8425}> 
(#.(CXML-STP-IMPL::DOCUMENT :CHILDREN '(#1=#.(CXML-STP:ELEMENT #| 
:PARENT of type DOCUMENT |# :LOCAL-NAME "etx"))) #1# . #<CLOSURE # 
{C2B84FD}>))
   6: ((LAMBDA (XPATH::NODE XPATH::STARTING-NODE)) ..)
   7: ((LAMBDA (XPATH::N)) #.(CXML-STP-IMPL::DOCUMENT :CHILDREN 
'(#.(CXML-STP:ELEMENT #| :PARENT of type DOCUMENT |# :LOCAL-NAME "etx"))))
   8: (XPATH::MAPPEND-PIPE #<CLOSURE (LAMBDA #) {C2B83C5}> 
(#.(CXML-STP-IMPL::DOCUMENT :CHILDREN '(#.(CXML-STP:ELEMENT #| :PARENT 
of type DOCUMENT |# :LOCAL-NAME "etx"))) . #<CLOSURE # {C2B83A5}>))
   9: ((LAMBDA (XPATH::NODE XPATH::STARTING-NODE)) ..)
  10: ((LAMBDA (XPATH:CONTEXT)) #<XPATH:CONTEXT {C2B8361}>)
  11: (XPATH:EVALUATE-COMPILED #<CLOSURE (LAMBDA #) {C2B8355}> 
#.(CXML-STP-IMPL::DOCUMENT :CHILDREN '(#.(CXML-STP:ELEMENT #| :PARENT of 
type DOCUMENT |# :LOCAL-NAME "etx"))) NIL)
  12: (SB-INT:SIMPLE-EVAL-IN-LEXENV (XPATH:EVALUATE "//foo" (CXML:PARSE 
"<etx></etx>" (CXML-STP:MAKE-BUILDER))) #<NULL-LEXENV>)
  --more--




More information about the plexippus-xpath-devel mailing list