KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > xml > sax > DelegatingContentHandler


1 package com.thaiopensource.xml.sax;
2
3 import org.xml.sax.ContentHandler JavaDoc;
4 import org.xml.sax.Locator JavaDoc;
5 import org.xml.sax.SAXException JavaDoc;
6 import org.xml.sax.Attributes JavaDoc;
7
8 public class DelegatingContentHandler implements ContentHandler JavaDoc {
9   private ContentHandler JavaDoc delegate;
10
11   public DelegatingContentHandler() {
12   }
13
14   public DelegatingContentHandler(ContentHandler JavaDoc delegate) {
15     this.delegate = delegate;
16   }
17
18   public ContentHandler JavaDoc getDelegate() {
19     return delegate;
20   }
21
22   public void setDelegate(ContentHandler JavaDoc delegate) {
23     this.delegate = delegate;
24   }
25
26   public void setDocumentLocator (Locator JavaDoc locator) {
27     if (delegate != null)
28       delegate.setDocumentLocator(locator);
29   }
30
31   public void startDocument ()
32       throws SAXException JavaDoc {
33     if (delegate != null)
34       delegate.startDocument();
35   }
36
37   public void endDocument()
38       throws SAXException JavaDoc {
39     if (delegate != null)
40       delegate.endDocument();
41   }
42
43   public void startPrefixMapping (String JavaDoc prefix, String JavaDoc uri)
44       throws SAXException JavaDoc {
45     if (delegate != null)
46       delegate.startPrefixMapping(prefix, uri);
47   }
48
49   public void endPrefixMapping (String JavaDoc prefix)
50       throws SAXException JavaDoc {
51     if (delegate != null)
52       delegate.endPrefixMapping(prefix);
53   }
54
55   public void startElement (String JavaDoc namespaceURI, String JavaDoc localName,
56                             String JavaDoc qName, Attributes JavaDoc atts)
57       throws SAXException JavaDoc {
58     if (delegate != null)
59       delegate.startElement(namespaceURI, localName, qName, atts);
60   }
61
62   public void endElement (String JavaDoc namespaceURI, String JavaDoc localName,
63                           String JavaDoc qName)
64       throws SAXException JavaDoc {
65     if (delegate != null)
66       delegate.endElement(namespaceURI, localName, qName);
67   }
68
69   public void characters (char ch[], int start, int length)
70       throws SAXException JavaDoc {
71     if (delegate != null)
72       delegate.characters(ch, start, length);
73   }
74
75   public void ignorableWhitespace (char ch[], int start, int length)
76       throws SAXException JavaDoc {
77     if (delegate != null)
78       delegate.ignorableWhitespace(ch, start, length);
79   }
80
81   public void processingInstruction (String JavaDoc target, String JavaDoc data)
82       throws SAXException JavaDoc {
83     if (delegate != null)
84       delegate.processingInstruction(target, data);
85   }
86
87   public void skippedEntity (String JavaDoc name)
88       throws SAXException JavaDoc {
89     if (delegate != null)
90       delegate.skippedEntity(name);
91   }
92 }
93
Popular Tags