up
import javax.xml.parsers.*;
import org.xml.sax.XMLReader;
import java.io.File;
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.SAXException;
class SAXEnt {
static public void main(String[] args) throws Exception {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
XMLReader xmlReader = saxParser.getXMLReader();
xmlReader.setProperty(
"http://xml.org/sax/properties/lexical-handler",
new MyLexicalHandler()
);
xmlReader.parse( new File(args[0]).toURL().toString() );
} }
class MyLexicalHandler implements LexicalHandler {
<.trace recognized entities and CDATA events.>
public void comment (char[] text, int start, int length){}
public void startDTD(String x, String y, String z){}
public void endDTD(){}
} -_-_-