public class XmlReader.Handler extends java.lang.Object implements XmlHandler
Constructor and Description |
---|
Handler() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
_currentExternalEntity()
Return the current external entity.
|
void |
attribute(java.lang.String name,
java.lang.String value,
boolean specified)
Handle an attribute assignment that is part of an XML element.
|
void |
charData(char[] c,
int offset,
int length)
Append the given character bytes to the character data of
the current XML element.
|
void |
doctypeDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Handle a document type declaration.
|
void |
endDocument()
End the document.
|
void |
endElement(java.lang.String name)
Move up one level in the parse tree.
|
void |
endExternalEntity(java.lang.String URI)
Move up one level in the external entity tree.
|
void |
error(java.lang.String message,
java.lang.String sysid,
int line,
int column)
Print an error message to the error stream.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Handle ignorable whitespace.
|
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Handle a processing instruction.
|
java.lang.Object |
resolveEntity(java.lang.String pubID,
java.lang.String sysID)
Attempt resolve the public ID representing an XML external
entity into a valid string url.
|
void |
startDocument()
Start a document.
|
void |
startElement(java.lang.String name)
Start an element.
|
void |
startExternalEntity(java.lang.String URI)
Move down one level in the entity tree.
|
public void attribute(java.lang.String name, java.lang.String value, boolean specified) throws java.lang.Exception
attribute
in interface XmlHandler
name
- The name of the attribute.value
- The value of the attribute, or null if the attribute
is #IMPLIED
and not specified.specified
- True if the value is specified, false if the
value comes from the default value in the DTD rather than from
the XML file.java.lang.Exception
- If the name or value is null.XmlHandler.startElement(java.lang.String)
,
XmlParser.declaredAttributes(java.lang.String)
,
XmlParser.getAttributeType(java.lang.String, java.lang.String)
,
XmlParser.getAttributeDefaultValue(java.lang.String, java.lang.String)
public void charData(char[] c, int offset, int length) throws java.lang.Exception
charData
in interface XmlHandler
c
- The character data.offset
- The starting position in the array.length
- The number of characters available.java.lang.Exception
- The handler may throw any exception.public void doctypeDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws java.lang.Exception
doctypeDecl
in interface XmlHandler
name
- The document type name.publicId
- The public identifier, or null if unspecified.systemId
- The system identifier, or null if unspecified.java.lang.Exception
- The handler may throw any exception.public void endDocument() throws java.lang.Exception
endDocument
in interface XmlHandler
java.lang.Exception
- The handler may throw any exception.XmlHandler.startDocument()
public void endElement(java.lang.String name) throws java.lang.Exception
endElement
in interface XmlHandler
name
- The element type name.java.lang.Exception
- The handler may throw any exception.XmlHandler.startElement(java.lang.String)
,
XmlParser.declaredElements()
,
XmlParser.getElementContentType(java.lang.String)
public void endExternalEntity(java.lang.String URI) throws java.lang.Exception
endExternalEntity
in interface XmlHandler
URI
- The URI of the external entity that is ending.XmlException
- If given URI was not the URI that was expected,
based on the external entity tree.java.lang.Exception
- The handler may throw any exception.XmlHandler.startExternalEntity(java.lang.String)
,
XmlHandler.resolveEntity(java.lang.String, java.lang.String)
public void error(java.lang.String message, java.lang.String sysid, int line, int column) throws java.lang.Exception
error
in interface XmlHandler
message
- The error message.sysid
- The system identifier of the entity that
contains the error.line
- The approximate line number of the error.column
- The approximate column number of the error.java.lang.Exception
- The handler may throw any exception.XmlException
public void ignorableWhitespace(char[] ch, int start, int length) throws java.lang.Exception
The default implementation does nothing.
ignorableWhitespace
in interface XmlHandler
ch
- The literal whitespace characters.start
- The starting position in the array.length
- The number of whitespace characters available.java.lang.Exception
- Derived methods may throw exceptions.XmlHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(java.lang.String target, java.lang.String data) throws java.lang.Exception
The default implementation does nothing.
processingInstruction
in interface XmlHandler
target
- The target (the name at the start of the PI).data
- The data, if any (the rest of the PI).java.lang.Exception
- Derived methods may throw exceptions.XmlHandler.processingInstruction(java.lang.String, java.lang.String)
public java.lang.Object resolveEntity(java.lang.String pubID, java.lang.String sysID) throws java.lang.Exception
resolveEntity
in interface XmlHandler
pubID
- The public identifier, or null if none was supplied.sysID
- The system identifier.java.lang.Exception
- The handler may throw any exception.XmlHandler.startExternalEntity(java.lang.String)
,
XmlHandler.endExternalEntity(java.lang.String)
public void startDocument()
startDocument
in interface XmlHandler
XmlHandler.endDocument()
public void startElement(java.lang.String name)
startElement
in interface XmlHandler
name
- the element type of the element that is beginning.XmlHandler.attribute(java.lang.String, java.lang.String, boolean)
,
XmlHandler.endElement(java.lang.String)
,
XmlParser.declaredElements()
,
XmlParser.getElementContentType(java.lang.String)
public void startExternalEntity(java.lang.String URI) throws java.lang.Exception
startExternalEntity
in interface XmlHandler
URI
- The URI of the external entity that is starting.java.lang.Exception
- The handler may throw any exception.XmlHandler.endExternalEntity(java.lang.String)
,
XmlHandler.resolveEntity(java.lang.String, java.lang.String)
protected java.lang.String _currentExternalEntity()