/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/scripts/libxml.py

  • Committer: Suren A. Chilingaryan
  • Date: 2009-10-08 03:17:59 UTC
  • Revision ID: csa@dside.dyndns.org-20091008031759-u5ys779huye7feni
LibXML Pull Parser, FAXPP Parser, Mono security benchmark, multiple fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
        sum = 0.
13
13
 
14
14
        for node in nodes:
15
 
            if (node.children is not None and node.children.type == "text"):
 
15
            child = node.children
 
16
            if (child is not None and child.type == "text"):
16
17
                try:
17
 
                    res = float(node.children.content) 
 
18
                    res = float(child.content) 
18
19
                    if res:
19
20
                        sum += res
20
21
                        continue
21
22
                except ValueError:
22
23
                    pass
23
24
                    #Exception is not actually thrown in my python, but just 0 is returned
24
 
                    #raise ValueError;
 
25
                    #raise ValueError
25
26
 
26
27
            attrs = node.get_properties()
27
28
            for attr in attrs if attrs is not None else []:
33
34
                except ValueError:
34
35
                    pass
35
36
                    #Exception is not actually thrown in my python, but just 0 is returned
36
 
                    #raise ValueError;
 
37
                    #raise ValueError
37
38
 
38
39
                
39
40
        ctxt.xpathFreeContext()
41
42
    doc.freeDoc
42
43
 
43
44
 
44
 
walk_tree = os.environ['walk_tree']
 
45
try:
 
46
    walk_tree = os.environ['walk_tree']
 
47
except:
 
48
    walk_tree = None
45
49
 
46
50
if len(sys.argv) > 1:
47
51
    iterations = int(sys.argv[1])