public class XmlReader.Handler extends Object implements XmlHandler
Constructor and Description |
---|
Handler() |
Modifier and Type | Method and Description |
---|---|
protected String |
_currentExternalEntity() |
void |
attribute(String name,
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(String name,
String publicId,
String systemId)
Handle a document type declaration.
|
void |
endDocument()
End the document.
|
void |
endElement(String name)
Move up one level in the parse tree.
|
void |
endExternalEntity(String URI)
Move up one level in the external entity tree.
|
void |
error(String message,
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(String target,
String data)
Handle a processing instruction.
|
Object |
resolveEntity(String pubID,
String sysID)
Attempt resolve the public ID representing an XML external
entity into a valid string url.
|
void |
startDocument()
Start a document.
|
void |
startElement(String name)
Start an element.
|
void |
startExternalEntity(String URI)
Move down one level in the entity tree.
|
public void attribute(String name, String value, boolean specified) throws 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.XmlException
- If the name or value is null.Exception
- The handler may throw any exception.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 Exception
charData
in interface XmlHandler
c
- The character data.offset
- The starting position in the array.length
- The number of characters available.Exception
- The handler may throw any exception.public void doctypeDecl(String name, String publicId, String systemId) throws 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.Exception
- The handler may throw any exception.public void endDocument() throws Exception
endDocument
in interface XmlHandler
Exception
- The handler may throw any exception.XmlHandler.startDocument()
public void endElement(String name) throws Exception
endElement
in interface XmlHandler
name
- The element type name.Exception
- The handler may throw any exception.XmlHandler.startElement(java.lang.String)
,
XmlParser.declaredElements()
,
XmlParser.getElementContentType(java.lang.String)
public void endExternalEntity(String URI) throws 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.Exception
- The handler may throw any exception.XmlHandler.startExternalEntity(java.lang.String)
,
XmlHandler.resolveEntity(java.lang.String, java.lang.String)
public void error(String message, String sysid, int line, int column) throws 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.Exception
- The handler may throw any exception.XmlException
public void ignorableWhitespace(char[] ch, int start, int length) throws 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.Exception
- Derived methods may throw exceptions.com.microstar.xml.XmlHandler#ignorableWhitespace
public void processingInstruction(String target, String data) throws 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).Exception
- Derived methods may throw exceptions.com.microstar.xml.XmlHandler#processingInstruction
public Object resolveEntity(String pubID, String sysID) throws Exception
resolveEntity
in interface XmlHandler
pubID
- The public identifier, or null if none was supplied.sysID
- The system identifier.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(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(String URI) throws Exception
startExternalEntity
in interface XmlHandler
URI
- The URI of the external entity that is starting.Exception
- The handler may throw any exception.XmlHandler.endExternalEntity(java.lang.String)
,
XmlHandler.resolveEntity(java.lang.String, java.lang.String)
protected String _currentExternalEntity()
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.