1
2
3
4
5
6
7
8 package de.nierbeck.timeTrack.model.impl.runtime;
9
10 import org.xml.sax.Attributes;
11 import org.xml.sax.SAXException;
12
13 /***
14 * UnmarshallingEventHandler implementation that discards the whole sub-tree.
15 *
16 * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
17 */
18 class Discarder implements UnmarshallingEventHandler {
19
20 private final UnmarshallingContext context;
21
22
23 private int depth = 0;
24
25 public Discarder(UnmarshallingContext _ctxt) {
26 this.context = _ctxt;
27 }
28
29 public void enterAttribute(String uri, String local, String qname)
30 throws SAXException {
31 }
32
33 public void enterElement(String uri, String local, String qname,
34 Attributes atts) throws SAXException {
35 depth++;
36 }
37
38 public void leaveAttribute(String uri, String local, String qname)
39 throws SAXException {
40 }
41
42 public void leaveElement(String uri, String local, String qname)
43 throws SAXException {
44 depth--;
45 if (depth == 0)
46 context.popContentHandler();
47 }
48
49 public Object owner() {
50 return null;
51 }
52
53 public void text(String s) throws SAXException {
54 }
55
56 public void leaveChild(int nextState) throws SAXException {
57 }
58
59 }