Following the JavaDocs tutorial for SAX: The method usage() is not recognised from the main method. As far as I know it should be accessible as the methods are declared as static and exist within the same package as the main method.
public class Main {
public static void main(String args[]){
String filename = null;
//Checks to see if commnad line arguments are present
for (int i = 0; i < args.length; i++) {
filename = args[i];
if (i != args.length - 1) {
usage();
}
}
if (filename == null) {
usage();
}
//Defined in the same package as the main method
public class SAXLocalNameCount extends DefaultHandler{
private Hashtable tags;
public void startDocument() throws SAXException{
tags = new Hashtable();
}
//The problem method
private static void usage() {
System.err.println("Usage: SAXLocalNameCount <file.xml>");
System.err.println(" -usage or -help = this message");
System.exit(1);
}
}