001: /*
002: * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
003: * Copyright (C) 2006 - Javolution (http://javolution.org/)
004: * All rights reserved.
005: *
006: * Permission to use, copy, modify, and distribute this software is
007: * freely granted, provided that this notice is preserved.
008: */
009: package javolution.xml.sax;
010:
011: import javolution.text.CharArray;
012: import j2me.lang.CharSequence;
013: import org.xml.sax.Locator;
014: import org.xml.sax.SAXException;
015:
016: /**
017: * <p> Receives notification of the logical content of a document.</p>
018: *
019: * <p> It is a more efficient version of <code>org.xml.sax.ContentHandler</code>
020: * with {@link CharArray CharArray}/{@link CharSequence CharSequence}
021: * instead of the <code>String</code> to avoid forcing dynamic object
022: * allocations.</p>
023: *
024: * @author <a href="mailto:sax@megginson.com">David Megginson</a>
025: * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
026: * @version 4.0, June 16, 2006
027: */
028: public interface ContentHandler {
029:
030: /**
031: * Receives an object for locating the origin of SAX document events.
032: *
033: * @param locator the document locator.
034: */
035: void setDocumentLocator(Locator locator);
036:
037: /**
038: * Receives notification of the beginning of a document.
039: *
040: * @throws org.xml.sax.SAXException any SAX exception.
041: */
042: void startDocument() throws SAXException;
043:
044: /**
045: * Receives notification of the end of a document.
046: *
047: * @throws org.xml.sax.SAXException any SAX exception.
048: */
049: void endDocument() throws SAXException;
050:
051: /**
052: * Begins the scope of a prefix-URI Namespace mapping.
053: *
054: * @param prefix the Namespace prefix being declared.
055: * @param uri the namespace URI the prefix is mapped to.
056: * @throws org.xml.sax.SAXException any SAX exception.
057: */
058: void startPrefixMapping(CharArray prefix, CharArray uri)
059: throws SAXException;
060:
061: /**
062: * Ends the scope of a prefix-URI mapping.
063: *
064: * @param prefix the prefix that was being mapping.
065: * @throws org.xml.sax.SAXException any SAX exception.
066: */
067: void endPrefixMapping(CharArray prefix) throws SAXException;
068:
069: /**
070: * Receives notification of the beginning of an element.
071: *
072: * @param uri the namespace URI, or an empty character sequence if the
073: * element has no Namespace URI or if namespace processing is not
074: * being performed.
075: * @param localName the local name (without prefix), or an empty character
076: * sequence if namespace processing is not being performed.
077: * @param qName the qualified name (with prefix), or an empty character
078: * sequence if qualified names are not available.
079: * @param atts the attributes attached to the element. If there are no
080: * attributes, it shall be an empty {@link Attributes} object.
081: * @throws org.xml.sax.SAXException any SAX exception.
082: */
083: void startElement(CharArray uri, CharArray localName,
084: CharArray qName, Attributes atts) throws SAXException;
085:
086: /**
087: * Receives notification of the end of an element.
088: *
089: * @param uri the namespace URI, or an empty character sequence if the
090: * element has no Namespace URI or if namespace processing is not
091: * being performed.
092: * @param localName the local name (without prefix), or an empty character
093: * sequence if namespace processing is not being performed.
094: * @param qName the qualified XML 1.0 name (with prefix), or an empty
095: * character sequence if qualified names are not available.
096: * @throws org.xml.sax.SAXException any SAX exception.
097: */
098: void endElement(CharArray uri, CharArray localName, CharArray qName)
099: throws SAXException;
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)
110: throws SAXException;
111:
112: /**
113: * Receives notification of ignorable whitespace in element content.
114: *
115: * @param ch the characters from the XML document.
116: * @param start the start position in the array.
117: * @param length the number of characters to read from the array.
118: * @throws org.xml.sax.SAXException any SAX exception.
119: */
120: void ignorableWhitespace(char ch[], int start, int length)
121: throws SAXException;
122:
123: /**
124: * Receives notification of a processing instruction.
125: *
126: * @param target the processing instruction target.
127: * @param data the processing instruction data, or null if
128: * none was supplied. The data does not include any
129: * whitespace separating it from the target.
130: * @throws org.xml.sax.SAXException any SAX exception.
131: */
132: void processingInstruction(CharArray target, CharArray data)
133: throws SAXException;
134:
135: /**
136: * Receives notification of a skipped entity.
137: *
138: * @param name the name of the skipped entity. If it is a
139: * parameter entity, the name will begin with '%', and if
140: * it is the external DTD subset, it will be the character sequence
141: * "[dtd]".
142: * @throws org.xml.sax.SAXException any SAX exception.
143: */
144: void skippedEntity(CharArray name) throws SAXException;
145:
146: }
|