- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReaderSAX.java
More file actions
Latest commit
22 lines (19 loc) · 624 Bytes
/
Copy pathReaderSAX.java
File metadata and controls
22 lines (19 loc) · 624 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
importjavax.xml.parsers.SAXParserFactory;
importjavax.xml.parsers.SAXParser;
importjava.io.File;
publicclassReaderSAX {
publicstaticvoidread(Stringpath) {
try {
FilefXmlFile = newFile(path);
SAXHandlerhandler = newSAXHandler();
SAXParserFactoryfactory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
SAXParserparser = factory.newSAXParser();
parser.parse(fXmlFile, handler.handler);
handler.print();
}
catch (Exceptione) {
e.printStackTrace();
}
}
}