4
import javax.xml.parsers.DocumentBuilderFactory;
5
import javax.xml.parsers.DocumentBuilder;
7
public class sun_dom2 extends bench {
8
DocumentBuilderFactory factory;
9
DocumentBuilder parser;
10
final String JAXP_SS="http://java.sun.com/xml/jaxp/properties/schemaSource";
11
final String JAXP_SL="http://java.sun.com/xml/jaxp/properties/schemaLanguage";
12
final String W3C_Schema="http://www.w3.org/2001/XMLSchema";
15
public void InitXML() {
16
factory = DocumentBuilderFactory.newInstance();
17
factory.setNamespaceAware(false);
18
factory.setValidating(false);
20
parser = factory.newDocumentBuilder();
22
catch (Throwable err) {
23
err.printStackTrace ();
29
public void InitXML_Validation() {
30
factory = DocumentBuilderFactory.newInstance();
31
factory.setNamespaceAware(true);
32
factory.setValidating(true);
34
factory.setAttribute(JAXP_SL,W3C_Schema);
36
catch (IllegalArgumentException x) {
37
System.out.println("JAXP 1.2 Unsupported!");
40
// factory.setAttribute(JAXP_SS,new File("test.xsd"));
42
parser = factory.newDocumentBuilder();
44
catch (Throwable err) {
45
err.printStackTrace ();
52
public void ParseXML(FileInputStream is, int iters, int iter) {
58
System.out.println(e.toString());
62
public void ValidateXML(FileInputStream is, int iters, int iter) {
68
System.out.println(e.toString());
72
static public void main(String argv[]) throws IOException {
73
bench mybench = new sun_dom2();
b'\\ No newline at end of file'