/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk

« back to all changes in this revision

Viewing changes to parse/lisp/libxml.cl

  • Committer: Suren A. Chilingaryan
  • Date: 2009-10-09 04:07:13 UTC
  • Revision ID: csa@dside.dyndns.org-20091009040713-mel06whc852tf2xz
XPath expression optimizations, various fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
(asdf:oos 'asdf:load-op :cl-libxml2)
7
7
(asdf:oos 'asdf:load-op :iterate)
8
8
 
9
 
(defvar *xpath_expr* "//*[(number(@*) or number(text())) and (count(../child::*)>3)]")
 
9
(defvar *xpath_expr* "//*[count(child::*)>3]/*[number(@*) or number(text())]")
10
10
(defvar *attrs_xe* (xpath:compile-expression "./@*"))
11
11
 
12
12
(defun my-getenv (name &optional default)
68
68
    (xtree:with-parse-document (doc (pathname fn)) 
69
69
        (if (my-getenv "walk_tree")
70
70
            (let ((nodeset (doc_search doc)))
71
 
                (loop for i from 0 to (- (xpath:node-set-length nodeset) 1) do 
72
 
                    (setf *sum* (+ *sum* (get_value (xpath:node-set-at nodeset i))))
 
71
                (if nodeset
 
72
                    (loop for i from 0 to (- (xpath:node-set-length nodeset) 1) do 
 
73
                        (setf *sum* (+ *sum* (get_value (xpath:node-set-at nodeset i))))
 
74
                    )
73
75
                )
74
76
;               (print *sum*)
75
77
            ))