I have made a sax parser, having the main class that has the main method, and setting the parser using XMLReader.setContentHandler(myCustomParserClass)
, which is a separate class that extends DefaultHandler:
public class SAXHandler { public static void Main(String args[]) { XMLReader.setContentHandler(myCustomParserClass); } } class MyCustomParserClass extends DefaultHandler { ... }
But I have a problem. It is an assignment, and the condition is that the main class has to extend the DefaultHandler, such as:
class SAXHandler extends DefaultHandler { public static void main(String args[]) { ... } public void startElement(String uri...) { } public void endElement(String uri...) { }
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.
Thank you in advance
Tiada ulasan:
Catat Ulasan