Java SAX: how to use DefaultHandler in the main class
<p>I have made a sax parser, having the main class that has the main method, and setting the parser using <code>XMLReader.setContentHandler(myCustomParserClass)</code>, which is a separate class that extends DefaultHandler:</p>

<pre><code> public class SAXHandler {

    public static void Main(String args[]) {
       XMLReader.setContentHandler(myCustomParserClass); } 
  }

  class MyCustomParserClass extends DefaultHandler { ... }
</code></pre>

<p>But I have a problem. It is an assignment, and the condition is that the main class has to extend the DefaultHandler, such as:</p>

<pre><code>    class SAXHandler extends DefaultHandler {

      public static void main(String args[]) { ... }

      public void startElement(String uri...) { }
      public void endElement(String uri...) { }
</code></pre>

<p>And I don't really have an idea how do I implement the XMLReader, what do I set as the content handler when the class that is the parser... is also the class that has the main method and there has to be one only this one class in the file.</p>

<p>Thank you in advance</p>