/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/sxml-sax.cl

  • Committer: Suren A. Chilingaryan
  • Date: 2009-09-28 21:25:28 UTC
  • Revision ID: csa@dside.dyndns.org-20090928212528-e6oby5he4yrueskz
Parsing tests for mono, vtd-xml, lisp, scripting languages

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/clisp -C -q -q
 
2
; Should be called from root account once to generate binaries for libraries
 
3
 
 
4
(load #p"/usr/share/common-lisp/source/asdf/asdf.lisp")
 
5
(push #p"/usr/share/common-lisp/systems/" asdf:*central-registry*)
 
6
(asdf:oos 'asdf:load-op :s-xml)
 
7
 
 
8
;(in-package :s-xml)
 
9
 
 
10
(defvar dom NIL)
 
11
 
 
12
(defun parse_xml (xml)
 
13
  (s-xml::start-parse-xml 
 
14
    xml
 
15
    (make-instance 's-xml::xml-parser-state
 
16
        :new-element-hook #'(lambda (name attributes seed) ())
 
17
        :finish-element-hook #'(lambda (name attributes parent-seed seed) ())
 
18
        :text-hook #'(lambda (string seed) ())
 
19
;       :text-hook #'(lambda (string seed) (princ string))
 
20
    )))
 
21
;                                (princ string out)))))
 
22
 
 
23
(defun parse_file (fn)
 
24
    (setf dom
 
25
        (with-open-file 
 
26
            (xml fn) 
 
27
            (parse_xml xml))))
 
28
 
 
29
(defun parse_iteration (fn i)
 
30
    (if fn
 
31
        (parse_file fn)
 
32
        (parse_file (concatenate 'string "../xml.tmp/" (write-to-string i) ".xml"))))
 
33
 
 
34
 
 
35
(defvar iterations NIL)
 
36
(defvar xmlfn NIL)
 
37
 
 
38
(if (> (length *ARGS*) 0)
 
39
    (setf iterations (parse-integer (first *ARGS*)))
 
40
    (setf iterations 0))
 
41
 
 
42
(if (> (length *ARGS*) 1)
 
43
    (setf xmlfn (second *ARGS*))
 
44
    (setf xmlfn NIL))
 
45
 
 
46
(parse_iteration xmlfn 0)
 
47
;(pprint (list "Number of Iterations" iterations))
 
48
(if (> iterations 0)
 
49
    (time
 
50
        (dotimes (i iterations) 
 
51
            (parse_iteration xmlfn (+ i 1))))
 
52
    (dotimes (i iterations) 
 
53
        (parse_iteration xmlfn (+ i 1))))
 
54