Samstag, 7. Mai 2011
Parsing a XML file with SAX
mattki, 02:07h
// Create a JAXP "parser factory" for creating SAX parsers
SAXParserFactory spf =
SAXParserFactory.newInstance();
// Configure the parser factory for the type of parsers we require
spf.setValidating(false);
// Now use the parser factory to create a SAXParser object
// Note that SAXParser is a JAXP class, not a SAX class
SAXParser sp = spf.newSAXParser();
// Finally, tell the parser to parse the input and notify the handler
sp.parse(new InputSource(new FileInputStream(file)), defaultHandler);
... comment