1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| public class LegacyParser extends SuperParser3...SuperParser1 {
private ParsedResultBean bean; private ModuleElement1 element1; private ModuleElement2 element1; ... private ModuleElementN elementn;
private Map<String, IModuleElement> elementGroup1 = new HashMap(); ... private Map<String, IModuleElement> elementGroupn = new HashMap();
public LegacyParser(ParsedResultBean bean) {...} public LegacyParser(ParsedResultBean bean, boolean moduleFlag1) {...} public LegacyParser(ParsedResultBean bean, boolean moduleFlag1, boolean moduleFlag2) {...}
private Map<String, ElementParser> availableParsers = new HashMap();
private class ElementParser1 extends BaseElementParser...DefaultHander implements IElementParser {
@Override public String getElementName() { return ElementName1; }
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { elementGroup1.put(...); }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { }
private void moduleMehtods(...) { } }
private class ElementParser2...N extends BaseElementParser...DefaultHander implements IElementParser {}
@Override public void startElement(String uri, String localName, String name, Attributes attrs) throws SAXException { if (availableParsers.containsKey(name)) { elementParsers.get(name).startElement(uri, localName, name, attrs); } else { throw new SAXException("Unexpected element " + name); } }
@Override public void endElement(String uri, String localName, String name, Attributes attrs) throws SAXException { if (availableParsers.containsKey(name)) { elementParsers.get(name).endElement(uri, localName, name, attrs); } else { throw new SAXException("Unexpected element " + name); } } }
|