SAX解析

SAX解析与DOM解析相比,没有DOM好理解

主要特点:

startDocument

startElement

characters

endElement

endDocument


sax解析时用到的解析器

SAXParserFactory factory = SAXParserFactory.newInstance();

System.out.println("222222");

SAXParser parser = factory.newSAXParser();

SaxForXml sax = new SaxForXml();

parser.parse(new File("newStudent.xml"), sax);

你可能感兴趣的:(SAX解析)