KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javolution > xml > sax > ContentHandler


1 /*
2  * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
3  * Copyright (C) 2006 - Javolution (http://javolution.org/)
4  * All rights reserved.
5  *
6  * Permission to use, copy, modify, and distribute this software is
7  * freely granted, provided that this notice is preserved.
8  */

9 package javolution.xml.sax;
10
11 import javolution.text.CharArray;
12 import j2me.lang.CharSequence;
13 import org.xml.sax.Locator JavaDoc;
14 import org.xml.sax.SAXException JavaDoc;
15
16 /**
17  * <p> Receives notification of the logical content of a document.</p>
18  *
19  * <p> It is a more efficient version of <code>org.xml.sax.ContentHandler</code>
20  * with {@link CharArray CharArray}/{@link CharSequence CharSequence}
21  * instead of the <code>String</code> to avoid forcing dynamic object
22  * allocations.</p>
23  *
24  * @author <a HREF="mailto:sax@megginson.com">David Megginson</a>
25  * @author <a HREF="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
26  * @version 4.0, June 16, 2006
27  */

28 public interface ContentHandler {
29
30     /**
31      * Receives an object for locating the origin of SAX document events.
32      *
33      * @param locator the document locator.
34      */

35     void setDocumentLocator(Locator JavaDoc locator);
36
37     /**
38      * Receives notification of the beginning of a document.
39      *
40      * @throws org.xml.sax.SAXException any SAX exception.
41      */

42     void startDocument() throws SAXException JavaDoc;
43
44     /**
45      * Receives notification of the end of a document.
46      *
47      * @throws org.xml.sax.SAXException any SAX exception.
48      */

49     void endDocument() throws SAXException JavaDoc;
50
51     /**
52      * Begins the scope of a prefix-URI Namespace mapping.
53      *
54      * @param prefix the Namespace prefix being declared.
55      * @param uri the namespace URI the prefix is mapped to.
56      * @throws org.xml.sax.SAXException any SAX exception.
57      */

58     void startPrefixMapping(CharArray prefix, CharArray uri)
59         throws SAXException JavaDoc;
60
61     /**
62      * Ends the scope of a prefix-URI mapping.
63      *
64      * @param prefix the prefix that was being mapping.
65      * @throws org.xml.sax.SAXException any SAX exception.
66      */

67     void endPrefixMapping(CharArray prefix) throws SAXException JavaDoc;
68
69     /**
70      * Receives notification of the beginning of an element.
71      *
72      * @param uri the namespace URI, or an empty character sequence if the
73      * element has no Namespace URI or if namespace processing is not
74      * being performed.
75      * @param localName the local name (without prefix), or an empty character
76      * sequence if namespace processing is not being performed.
77      * @param qName the qualified name (with prefix), or an empty character
78      * sequence if qualified names are not available.
79      * @param atts the attributes attached to the element. If there are no
80      * attributes, it shall be an empty {@link Attributes} object.
81      * @throws org.xml.sax.SAXException any SAX exception.
82      */

83     void startElement(CharArray uri, CharArray localName,
84                       CharArray qName, Attributes atts) throws SAXException JavaDoc;
85
86     /**
87      * Receives notification of the end of an element.
88      *
89      * @param uri the namespace URI, or an empty character sequence if the
90      * element has no Namespace URI or if namespace processing is not
91      * being performed.
92      * @param localName the local name (without prefix), or an empty character
93      * sequence if namespace processing is not being performed.
94      * @param qName the qualified XML 1.0 name (with prefix), or an empty
95      * character sequence if qualified names are not available.
96      * @throws org.xml.sax.SAXException any SAX exception.
97      */

98     void endElement (CharArray uri, CharArray localName,
99         CharArray qName) throws SAXException JavaDoc;
100
101     /**
102      * Receives notification of character data.
103      *
104      * @param ch the characters from the XML document.
105      * @param start the start position in the array.
106      * @param length the number of characters to read from the array.
107      * @throws org.xml.sax.SAXException any SAX exception.
108      */

109     void characters(char ch[], int start, int length) throws SAXException JavaDoc;
110
111     /**
112      * Receives notification of ignorable whitespace in element content.
113      *
114      * @param ch the characters from the XML document.
115      * @param start the start position in the array.
116      * @param length the number of characters to read from the array.
117      * @throws org.xml.sax.SAXException any SAX exception.
118      */

119     void ignorableWhitespace(char ch[], int start, int length)
120         throws SAXException JavaDoc;
121
122     /**
123      * Receives notification of a processing instruction.
124      *
125      * @param target the processing instruction target.
126      * @param data the processing instruction data, or null if
127      * none was supplied. The data does not include any
128      * whitespace separating it from the target.
129      * @throws org.xml.sax.SAXException any SAX exception.
130      */

131     void processingInstruction(CharArray target, CharArray data)
132         throws SAXException JavaDoc;
133
134     /**
135      * Receives notification of a skipped entity.
136      *
137      * @param name the name of the skipped entity. If it is a
138      * parameter entity, the name will begin with '%', and if
139      * it is the external DTD subset, it will be the character sequence
140      * "[dtd]".
141      * @throws org.xml.sax.SAXException any SAX exception.
142      */

143     void skippedEntity(CharArray name) throws SAXException JavaDoc;
144
145 }
Popular Tags