private void addStartElementMethod() { Method m = SourceFactory.newMethod("startElement", TypeFactory.newVoidType(pack)); m.setAccessLevel(AccessLevel.PUBLIC); Type t = TypeFactory.newReferenceType(pack, "java.lang.String", "String"); m.addArgument(SourceFactory.newVariable("namespaceURI", t)); m.addArgument(SourceFactory.newVariable("localName", t)); m.addArgument(SourceFactory.newVariable("qName", t)); t = TypeFactory.newReferenceType(pack, "org.xml.sax.Attributes", "Attributes"); m.addArgument(SourceFactory.newVariable("atts", t)); m.addException( TypeFactory.newReferenceType(pack, "org.xml.sax.SAXException", "SAXException")); m.addSourceLine("super.startElement(namespaceURI, localName, qName, atts);"); m.addSourceLine("if (_root != null) return;"); // ... MyHandlerClass.defaultStartElementCode(m, "_root"); m.addSourceLine("_parseStack.push(_root);"); addMethod(m); }