/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/intel_dom2.java

  • Committer: Suren A. Chilingaryan
  • Date: 2009-09-23 17:13:04 UTC
  • Revision ID: csa@dside.dyndns.org-20090923171304-osvtr4zqb29h11kd
Intel, Tango, Phobos, and RapidXML parsers; Memory benchmark scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import java.io.*;
 
2
import java.util.*;
 
3
import java.text.*;
 
4
import javax.xml.parsers.DocumentBuilderFactory; 
 
5
import javax.xml.parsers.DocumentBuilder; 
 
6
 
 
7
import org.w3c.dom.Document;
 
8
 
 
9
public class intel_dom2 extends bench {
 
10
 
 
11
    DocumentBuilder parser;
 
12
    DocumentBuilderFactory factory;
 
13
    
 
14
    public void InitXML() {
 
15
        factory = DocumentBuilderFactory.newInstance();
 
16
        factory.setNamespaceAware(true);
 
17
        factory.setValidating(false);
 
18
        try {
 
19
            if (System.getenv("memory_bench")!=null) {
 
20
                factory.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", true);
 
21
            } else {
 
22
                factory.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false);
 
23
            }
 
24
        } catch (Throwable err) {
 
25
            // ignoring missing option
 
26
        }
 
27
        
 
28
        try {
 
29
            parser = factory.newDocumentBuilder();
 
30
        }
 
31
        catch (Throwable err) {
 
32
            err.printStackTrace ();
 
33
        }
 
34
    }
 
35
 
 
36
    public void ParseXML(FileInputStream is, int iters, int iter) {
 
37
        try {
 
38
            Document doc = parser.parse(is);            
 
39
        }
 
40
        catch (Exception e)
 
41
        {
 
42
            System.out.println(e.toString());
 
43
        }
 
44
    }
 
45
  
 
46
    static public void main(String argv[]) throws IOException {
 
47
        bench mybench = new intel_dom2();
 
48
        mybench.Bench(argv);
 
49
    }
 
50
}