1 module XMLWebListener; 2 3 import antlr.v4.runtime.ParserRuleContext; 4 import antlr.v4.runtime.tree.ErrorNode; 5 import antlr.v4.runtime.tree.TerminalNode; 6 import XMLParser : XMLParser; 7 import XMLParserBaseListener; 8 9 debug 10 import std.stdio; 11 12 /** 13 * This class provides an empty implementation of {@link XMLParserListener}, 14 * which can be extended to create a listener which only needs to handle a subset 15 * of the available methods. 16 */ 17 public class XMLWebListener : XMLParserBaseListener { 18 /** 19 * {@inheritDoc} 20 * 21 * <p>The default implementation does nothing.</p> 22 */ 23 override public void enterDocument(XMLParser.DocumentContext ctx) { } 24 /** 25 * {@inheritDoc} 26 * 27 * <p>The default implementation does nothing.</p> 28 */ 29 override public void exitDocument(XMLParser.DocumentContext ctx) { } 30 /** 31 * {@inheritDoc} 32 * 33 * <p>The default implementation does nothing.</p> 34 */ 35 override public void enterProlog(XMLParser.PrologContext ctx) { } 36 /** 37 * {@inheritDoc} 38 * 39 * <p>The default implementation does nothing.</p> 40 */ 41 override public void exitProlog(XMLParser.PrologContext ctx) { } 42 /** 43 * {@inheritDoc} 44 * 45 * <p>The default implementation does nothing.</p> 46 */ 47 override public void enterContent(XMLParser.ContentContext ctx) { } 48 /** 49 * {@inheritDoc} 50 * 51 * <p>The default implementation does nothing.</p> 52 */ 53 override public void exitContent(XMLParser.ContentContext ctx) { } 54 /** 55 * {@inheritDoc} 56 * 57 * <p>The default implementation does nothing.</p> 58 */ 59 override public void enterElement(XMLParser.ElementContext ctx) { 60 debug 61 writefln("enterElement = %s", ctx.children[1].getText); } 62 /** 63 * {@inheritDoc} 64 * 65 * <p>The default implementation does nothing.</p> 66 */ 67 override public void exitElement(XMLParser.ElementContext ctx) { } 68 /** 69 * {@inheritDoc} 70 * 71 * <p>The default implementation does nothing.</p> 72 */ 73 override public void enterElementName(XMLParser.ElementNameContext ctx) { } 74 /** 75 * {@inheritDoc} 76 * 77 * <p>The default implementation does nothing.</p> 78 */ 79 override public void exitElementName(XMLParser.ElementNameContext ctx) { 80 debug 81 writefln("exitElementName = %s", ctx.getText); 82 } 83 /** 84 * {@inheritDoc} 85 * 86 * <p>The default implementation does nothing.</p> 87 */ 88 override public void enterReference(XMLParser.ReferenceContext ctx) { } 89 /** 90 * {@inheritDoc} 91 * 92 * <p>The default implementation does nothing.</p> 93 */ 94 override public void exitReference(XMLParser.ReferenceContext ctx) { } 95 /** 96 * {@inheritDoc} 97 * 98 * <p>The default implementation does nothing.</p> 99 */ 100 override public void enterAttribute(XMLParser.AttributeContext ctx) { } 101 /** 102 * {@inheritDoc} 103 * 104 * <p>The default implementation does nothing.</p> 105 */ 106 override public void exitAttribute(XMLParser.AttributeContext ctx) { } 107 /** 108 * {@inheritDoc} 109 * 110 * <p>The default implementation does nothing.</p> 111 */ 112 override public void enterAttributeName(XMLParser.AttributeNameContext ctx) { } 113 /** 114 * {@inheritDoc} 115 * 116 * <p>The default implementation does nothing.</p> 117 */ 118 override public void exitAttributeName(XMLParser.AttributeNameContext ctx) { } 119 /** 120 * {@inheritDoc} 121 * 122 * <p>The default implementation does nothing.</p> 123 */ 124 override public void enterAttValue(XMLParser.AttValueContext ctx) { } 125 /** 126 * {@inheritDoc} 127 * 128 * <p>The default implementation does nothing.</p> 129 */ 130 override public void exitAttValue(XMLParser.AttValueContext ctx) { } 131 /** 132 * {@inheritDoc} 133 * 134 * <p>The default implementation does nothing.</p> 135 */ 136 override public void enterChardata(XMLParser.ChardataContext ctx) { } 137 /** 138 * {@inheritDoc} 139 * 140 * <p>The default implementation does nothing.</p> 141 */ 142 override public void exitChardata(XMLParser.ChardataContext ctx) { } 143 /** 144 * {@inheritDoc} 145 * 146 * <p>The default implementation does nothing.</p> 147 */ 148 override public void enterMisc(XMLParser.MiscContext ctx) { } 149 /** 150 * {@inheritDoc} 151 * 152 * <p>The default implementation does nothing.</p> 153 */ 154 override public void exitMisc(XMLParser.MiscContext ctx) { } 155 156 /** 157 * {@inheritDoc} 158 * 159 * <p>The default implementation does nothing.</p> 160 */ 161 override public void enterEveryRule(ParserRuleContext ctx) { } 162 /** 163 * {@inheritDoc} 164 * 165 * <p>The default implementation does nothing.</p> 166 */ 167 override public void exitEveryRule(ParserRuleContext ctx) { } 168 /** 169 * {@inheritDoc} 170 * 171 * <p>The default implementation does nothing.</p> 172 */ 173 override public void visitTerminal(TerminalNode node) { } 174 /** 175 * {@inheritDoc} 176 * 177 * <p>The default implementation does nothing.</p> 178 */ 179 override public void visitErrorNode(ErrorNode node) { } 180 }