All Packages Class Hierarchy This Package Previous Next Index
Whenever you parse an XML document, you must provide an object from a class that implements this interface to receive the parsing events.
If you do not want to implement this entire interface, you
can extend the HandlerBase
convenience class and
then implement only what you need.
If you are using SAX, you should implement the SAX handler interfaces rather than this one.
public abstract void startDocument() throws Exception
Ælfred will call this method just before it attempts to read the first entity (the root of the document). It is guaranteed that this will be the first method called.
public abstract void endDocument() throws Exception
Ælfred will call this method once, when it has finished parsing the XML document. It is guaranteed that this will be the last method called.
public abstract Object resolveEntity(String publicId, String systemId) throws Exception
Give the handler a chance to redirect external entities to different URIs. Ælfred will call this method for the top-level document entity, for external text (XML) entities, and the external DTD subset (if any).
public abstract void startExternalEntity(String systemId) throws Exception
Ælfred will call this method at the beginning of each external entity, including the top-level document entity and the external DTD subset (if any).
If necessary, you can use this method to track the location of the current entity so that you can resolve relative URIs correctly.
public abstract void endExternalEntity(String systemId) throws Exception
Ælfred will call this method at the end of each external entity, including the top-level document entity and the external DTD subset.
If necessary, you can use this method to track the location of the current entity so that you can resolve relative URIs correctly.
public abstract void doctypeDecl(String name, String publicId, String systemId) throws Exception
Ælfred will call this method when or if it encounters the document type (DOCTYPE) declaration.
Please note that the public and system identifiers will not always be a reliable indication of the DTD in use.
public abstract void attribute(String aname, String value, boolean isSpecified) throws Exception
Ælfred will call this method once for each attribute (specified or defaulted) before reporting a startElement event. It is up to your handler to collect the attributes, if necessary.
You may use XmlParser.getAttributeType() to find the attribute's declared type.
#IMPLIED
.
public abstract void startElement(String elname) throws Exception
Ælfred will call this method at the beginning of each
element. By the time this is called, all of the attributes
for the element will already have been reported using the
attribute
method.
public abstract void endElement(String elname) throws Exception
Ælfred will call this method at the end of each element (including EMPTY elements).
public abstract void charData(char ch[], int start, int length) throws Exception
Ælfred will call this method once for each chunk of character data found in the contents of elements. Note that the parser may break up a long sequence of characters into smaller chunks and call this method once for each chunk.
Do not attempt to read more than length characters from the array, or to read before the start position.
public abstract void ignorableWhitespace(char ch[], int start, int length) throws Exception
Ælfred will call this method once for each sequence of ignorable whitespace in element content (never in mixed content).
For details, see section 2.10 of the XML 1.0 recommendation.
Do not attempt to read more than length characters from the array or to read before the start position.
public abstract void processingInstruction(String target, String data) throws Exception
Ælfred will call this method once for each processing instruction. Note that processing instructions may appear outside of the top-level element. The
public abstract void error(String message, String systemId, int line, int column) throws Exception
Ælfred will call this method whenever it encounters a serious error. The parser will attempt to continue past this point so that you can find more possible error points, but if this method is called you should assume that the document is corrupt and you should not try to use its contents.
Note that you can use the XmlException
class
to encapsulate all of the information provided, though the
use of the class is not mandatory.
All Packages Class Hierarchy This Package Previous Next Index