OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / lib / classpath / external / sax / org / xml / sax / ext / DefaultHandler2.java
1 // DefaultHandler2.java - extended DefaultHandler
2 // http://www.saxproject.org
3 // Public Domain: no warranty.
4 // $Id: DefaultHandler2.java,v 1.1 2004/12/23 22:38:42 mark Exp $
5
6 package org.xml.sax.ext;
7
8 import java.io.IOException;
9 import org.xml.sax.InputSource;
10 import org.xml.sax.SAXException;
11 import org.xml.sax.helpers.DefaultHandler;
12
13
14 /**
15  * This class extends the SAX2 base handler class to support the
16  * SAX2 {@link LexicalHandler}, {@link DeclHandler}, and
17  * {@link EntityResolver2} extensions.  Except for overriding the
18  * original SAX1 {@link DefaultHandler#resolveEntity resolveEntity()}
19  * method the added handler methods just return.  Subclassers may
20  * override everything on a method-by-method basis.
21  *
22  * <blockquote>
23  * <em>This module, both source code and documentation, is in the
24  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
25  * </blockquote>
26  *
27  * <p> <em>Note:</em> this class might yet learn that the
28  * <em>ContentHandler.setDocumentLocator()</em> call might be passed a
29  * {@link Locator2} object, and that the
30  * <em>ContentHandler.startElement()</em> call might be passed a
31  * {@link Attributes2} object.
32  *
33  * @since SAX 2.0 (extensions 1.1 alpha)
34  * @author David Brownell
35  * @version TBS
36  */
37 public class DefaultHandler2 extends DefaultHandler
38     implements LexicalHandler, DeclHandler, EntityResolver2
39 {
40     /** Constructs a handler which ignores all parsing events. */
41     public DefaultHandler2 () { }
42
43
44     // SAX2 ext-1.0 LexicalHandler
45
46     public void startCDATA ()
47     throws SAXException
48         {}
49
50     public void endCDATA ()
51     throws SAXException
52         {}
53
54     public void startDTD (String name, String publicId, String systemId)
55     throws SAXException
56         {}
57
58     public void endDTD ()
59     throws SAXException
60         {}
61
62     public void startEntity (String name)
63     throws SAXException
64         {}
65
66     public void endEntity (String name)
67     throws SAXException
68         {}
69
70     public void comment (char ch [], int start, int length)
71     throws SAXException
72         { }
73
74
75     // SAX2 ext-1.0 DeclHandler
76
77     public void attributeDecl (String eName, String aName,
78             String type, String mode, String value)
79     throws SAXException
80         {}
81
82     public void elementDecl (String name, String model)
83     throws SAXException
84         {}
85
86     public void externalEntityDecl (String name,
87         String publicId, String systemId)
88     throws SAXException
89         {}
90
91     public void internalEntityDecl (String name, String value)
92     throws SAXException
93         {}
94
95     // SAX2 ext-1.1 EntityResolver2
96
97     /**
98      * Tells the parser that if no external subset has been declared
99      * in the document text, none should be used.
100      */
101     public InputSource getExternalSubset (String name, String baseURI)
102     throws SAXException, IOException
103         { return null; }
104
105     /**
106      * Tells the parser to resolve the systemId against the baseURI
107      * and read the entity text from that resulting absolute URI.
108      * Note that because the older
109      * {@link DefaultHandler#resolveEntity DefaultHandler.resolveEntity()},
110      * method is overridden to call this one, this method may sometimes 
111      * be invoked with null <em>name</em> and <em>baseURI</em>, and
112      * with the <em>systemId</em> already absolutized.
113      */
114     public InputSource resolveEntity (String name, String publicId,
115             String baseURI, String systemId)
116     throws SAXException, IOException
117         { return null; }
118     
119     // SAX1 EntityResolver
120
121     /**
122      * Invokes
123      * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
124      * with null entity name and base URI.
125      * You only need to override that method to use this class.
126      */
127     public InputSource resolveEntity (String publicId, String systemId)
128     throws SAXException, IOException
129         { return resolveEntity (null, publicId, null, systemId); }
130 }