public class XmlHandler extends java.lang.Object implements XmlHandler
Red (tfeng) |
Red (tfeng) |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MoML_DTD_1
The standard MoML DTD, represented as a string.
|
static java.lang.String |
MoML_PUBLIC_ID_1
The public ID for version 1 MoML.
|
Constructor and Description |
---|
XmlHandler(ConfigXmlTree tree,
java.lang.String systemId)
Construct an XML handler with the given XML tree as the current tree.
|
Modifier and Type | Method and Description |
---|---|
void |
attribute(java.lang.String name,
java.lang.String value,
boolean isSpecified)
Handle an attribute.
|
void |
charData(char[] ch,
int start,
int length)
Handle a chunk of char data.
|
void |
doctypeDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Handle a document type declaration.
|
void |
endDocument()
Handle the end of the XML document.
|
void |
endElement(java.lang.String elementName)
Handle the end of an XML element.
|
void |
endExternalEntity(java.lang.String systemId)
Handle the end of an external entity.
|
void |
error(java.lang.String message,
java.lang.String systemId,
int line,
int column)
Signal an error message.
|
ConfigXmlTree |
getCurrentTree()
Return the current XML tree.
|
java.lang.String |
getSystemId()
Return the system ID of the XML document.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Handle consecutive ignorable white spaces.
|
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Handle a processing instruction.
|
java.lang.Object |
resolveEntity(java.lang.String publicId,
java.lang.String systemId)
Resolve an external entity.
|
void |
startDocument()
Handle the start of the XML document.
|
void |
startElement(java.lang.String elementName)
Handle the start of an XML element.
|
void |
startExternalEntity(java.lang.String systemId)
Handle the start of an external entity.
|
public static final java.lang.String MoML_DTD_1
public static final java.lang.String MoML_PUBLIC_ID_1
XmlHandler(ConfigXmlTree tree, java.lang.String systemId)
tree
- The initial XML tree.systemId
- The system ID of the document type.public void attribute(java.lang.String name, java.lang.String value, boolean isSpecified) throws java.lang.Exception
attribute
in interface XmlHandler
name
- The name of the attribute.value
- The value of the attribute.isSpecified
- true if the value was specified, false if it was
defaulted from the DTD.java.lang.Exception
- Not thrown in this base class.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[] ch, int start, int length) throws java.lang.Exception
charData
in interface XmlHandler
ch
- The character data.start
- The starting position in the array.length
- The number of characters available.java.lang.Exception
- Not thrown in this base class.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
- Not thrown in this base class.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 elementName) throws java.lang.Exception
endElement
in interface XmlHandler
elementName
- The name of the element.java.lang.Exception
- Not thrown in this base class.XmlHandler.startElement(java.lang.String)
,
XmlParser.declaredElements()
,
XmlParser.getElementContentType(java.lang.String)
public void endExternalEntity(java.lang.String systemId) throws java.lang.Exception
endExternalEntity
in interface XmlHandler
systemId
- The system ID of the external entity.java.lang.Exception
- Not thrown in this base class.XmlHandler.startExternalEntity(java.lang.String)
,
XmlHandler.resolveEntity(java.lang.String, java.lang.String)
public void error(java.lang.String message, java.lang.String systemId, int line, int column) throws java.lang.Exception
error
in interface XmlHandler
message
- The error message.systemId
- The system ID of the XML document that contains the
error.line
- The line number of the error.column
- The column number of the error.java.lang.Exception
- Not thrown in this base class.XmlException
public ConfigXmlTree getCurrentTree()
public java.lang.String getSystemId()
public void ignorableWhitespace(char[] ch, int start, int length) throws java.lang.Exception
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
- Not thrown in this base class.public void processingInstruction(java.lang.String target, java.lang.String data) throws java.lang.Exception
processingInstruction
in interface XmlHandler
target
- The target (the name at the start of the processing
instruction).data
- The data, if any (the rest of the processing instruction).java.lang.Exception
- Not thrown in this base class.public java.lang.Object resolveEntity(java.lang.String publicId, java.lang.String systemId) throws java.lang.Exception
resolveEntity
in interface XmlHandler
publicId
- The public ID, or null if none was supplied.systemId
- The system ID.java.lang.Exception
- Not thrown in this base class.XmlHandler.startExternalEntity(java.lang.String)
,
XmlHandler.endExternalEntity(java.lang.String)
public void startDocument() throws java.lang.Exception
startDocument
in interface XmlHandler
java.lang.Exception
- Not thrown in this base class.XmlHandler.endDocument()
public void startElement(java.lang.String elementName) throws java.lang.Exception
startElement
in interface XmlHandler
elementName
- The name of the XML element.java.lang.Exception
- Not thrown in this base class.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 systemId) throws java.lang.Exception
startExternalEntity
in interface XmlHandler
systemId
- The system ID of the external entity.java.lang.Exception
- Not thrown in this base class.XmlHandler.endExternalEntity(java.lang.String)
,
XmlHandler.resolveEntity(java.lang.String, java.lang.String)