How to read an xml document using SAX
Notes:
Sax exposes a org.xml.sax.XMLReader interface which must be implemented by all XML parsers. xerces implemented this interface in the org.apache.xerces.parsers.SAXParser class.
The first step is to create an instance of XMLReader. So
package test;
import org.xml.sax.XMLReader;
public class SaxRead1
{
public static void main(String[] args)
{
XMLReader reader = null;
}
}
Next to create an instance of SAXParser and assign it to XMLReader reference. So
package test;
import org.apache.xerces.parsers.SAXParser;
import org.xml.sax.XMLReader;
public class SaxRead1
{
public static void main(String[] args)
{
XMLReader reader = new SAXParser();
}
}
SAX call backs:
No comments:
Post a Comment