saxReader的列子
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class ImportTemplateSaxHandler extends DefaultHandler{ protected static final Logger logger = LoggerFactory.getLogger(ImportTemplateSaxHandler.class); @Override public void startDocument() throws SAXException { logger.info("test"); } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // no op logger.info(localName); logger.info(qName); if("Styles".equals(qName)) { } } @Override public void endElement(String uri, String localName, String qName) throws SAXException { // no op } }