List of utility methods to do XML SAX Parser
void | read(InputStream is, DefaultHandler h) Parse a stream in XML format using the specified handler SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); parser.parse(is, h); |
Schema | readSchemaFromFile(File schemaFile) read Schema From File return (SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI)).newSchema(schemaFile);
|
void | releaseSAXParser(SAXParser parser) release SAX Parser stack.push(parser); |
Schema | urlToSchema(final URL url) url To Schema SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); try { return factory.newSchema(url); } catch (SAXException e) { e.printStackTrace(); return null; |
XMLReader | xmlReader() xml Reader SAXParserFactory spf = SAX_PARSER_FACTORY.get(); if (spf == null) { spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); SAX_PARSER_FACTORY.set(spf); return spf.newSAXParser().getXMLReader(); |