forked from ScottOaks/JavaPerformanceTuning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSAXNonValidatingParserTest.java
More file actions
34 lines (29 loc) · 977 Bytes
/
Copy pathSAXNonValidatingParserTest.java
File metadata and controls
34 lines (29 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Copyright (c) 2013,2014 Scott Oaks. All rights reserved.
*/
package net.sdo;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
public class SAXNonValidatingParserTest extends SAXParserTest {
private SAXParser parser;
@Override
protected void engineInit(RunParams rp) throws IOException {
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setValidating(false);
spf.setNamespaceAware(false);
parser = spf.newSAXParser();
} catch (Exception ex) {
throw new IOException("Can't initialize parser" , ex);
}
}
@Override
protected XMLReader getReader() throws ParserConfigurationException, SAXException {
parser.reset();
return parser.getXMLReader();
}
}