Parsing XML with SAX : xerces « XML « Java






Parsing XML with SAX

 

import org.apache.xerces.parsers.SAXParser;
import org.xml.sax.InputSource;
import java.io.FileInputStream;

public class MainClass {

  public static void main(String args[]) throws Exception {
      SAXParser saxParser = new SAXParser();
      saxParser.setContentHandler(new EventHandler());
      saxParser.parse(new InputSource(new FileInputStream("games.xml")));

  }

}

 








Related examples in the same category

1.Walking a Document with DOM
2.Adding an Element with DOM
3.Adding an Attribute with DOM
4.Outputting a DOM with XMLSerializer
5.A simple example to show how to use the DOM API