01: /**
02: *
03: * © Copyright International Business Machines Corporation 2005, 2006.
04: * All rights reserved.
05: *
06: * The 'HamletHandler' class provides a default implementation of the
07: * 'ContentHandler' interface.
08: *
09: * File : HamletHandler.java
10: * Created : 2005/08/16
11: *
12: * @author Rene Pawlitzek (rpa@zurich.ibm.com)
13: * @version 2.00, 2005/08/16
14: * @since JDK 1.3
15: *
16: * History : 2005/08/16, rpa, new file
17: * 2006/03/14, rpa, code review
18: *
19: */package com.ibm.hamlet;
20:
21: import java.io.*;
22: import java.net.*;
23: import org.xml.sax.*;
24:
25: public class HamletHandler implements ContentHandler {
26:
27: private Hamlet hamlet;
28:
29: public HamletHandler(Hamlet hamlet) {
30: this .hamlet = hamlet;
31: } // HamletHandler
32:
33: public int getElementRepeatCount(String id, String name,
34: Attributes atts) throws Exception {
35: return 0;
36: } // getElementRepeatCount
37:
38: public String getElementReplacement(String id, String name,
39: Attributes atts) throws Exception {
40: return "";
41: } // getElementReplacement
42:
43: public Attributes getElementAttributes(String id, String name,
44: Attributes atts) throws Exception {
45: return atts;
46: } // getElementAttributes
47:
48: public InputStream getElementIncludeSource(String id, String name,
49: Attributes atts) throws Exception {
50: URL url = hamlet.getIncludeURL(atts.getValue("SRC"));
51: return url.openStream();
52: } // getElementIncludeSource
53:
54: } // HamletHandler
55:
56: /* ----- End of File ----- */
|