public class XmlApp extends java.lang.Object implements XmlHandler
This class fills in the basic interface, and provides an I/O infrastructure for simple applications and applets.
XmlParser,
XmlHandler,
EventDemo,
TimerDemo,
DtdDemo,
StreamDemo| Modifier and Type | Field and Description |
|---|---|
boolean |
isApplet
Flag to show whether we're running as an applet or application.
|
XmlParser |
parser |
| Constructor and Description |
|---|
XmlApp() |
| Modifier and Type | Method and Description |
|---|---|
void |
attribute(java.lang.String name,
java.lang.String value,
boolean isSpecified)
Handle an attribute value specification.
|
void |
charData(char[] ch,
int start,
int length)
Handle character data.
|
void |
doctypeDecl(java.lang.String name,
java.lang.String pubid,
java.lang.String sysid)
Handle a DOCTYPE declaration.
|
void |
endDocument()
Handle the end the document.
|
void |
endElement(java.lang.String name)
Handle the end of an element.
|
void |
endExternalEntity(java.lang.String systemId)
End an external entity.
|
void |
error(java.lang.String message,
java.lang.String url,
int line,
int column)
Handle a parsing error.
|
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 publicId,
java.lang.String systemId)
Resolve an external entity.
|
void |
startDocument()
Handle the start of the document.
|
void |
startElement(java.lang.String name)
Handle the start of an element.
|
void |
startExternalEntity(java.lang.String systemId)
Begin an external entity.
|
public boolean isApplet
public XmlApp()
public java.lang.Object resolveEntity(java.lang.String publicId, java.lang.String systemId)
This method could generate a new URL by looking up the public identifier in a hash table, or it could replace the URL supplied with a different, local one; for now, however, just return the URL supplied.
resolveEntity in interface XmlHandlerpublicId - The public identifier, or null if none was supplied.systemId - The system identifier.XmlHandler.resolveEntity(java.lang.String, java.lang.String)public void startExternalEntity(java.lang.String systemId)
XmlHandlerÆ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.
startExternalEntity in interface XmlHandlersystemId - The URI of the external entity that is starting.XmlHandler.endExternalEntity(java.lang.String),
XmlHandler.resolveEntity(java.lang.String, java.lang.String)public void endExternalEntity(java.lang.String systemId)
XmlHandlerÆ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.
endExternalEntity in interface XmlHandlersystemId - The URI of the external entity that is ending.XmlHandler.startExternalEntity(java.lang.String),
XmlHandler.resolveEntity(java.lang.String, java.lang.String)public void startDocument()
Do nothing for now. Subclasses can override this method if they want to take a specific action.
This method will always be called first.
startDocument in interface XmlHandlerXmlHandler.startDocument()public void endDocument()
Do nothing for now. Subclasses can override this method if they want to take a specific action.
This method will always be called last.
endDocument in interface XmlHandlerXmlHandler.endDocument()public void doctypeDecl(java.lang.String name, java.lang.String pubid, java.lang.String sysid)
Do nothing for now. Subclasses can override this method if they want to take a specific action.
Well-formed XML documents might not have one of these.
The query methods in XmlParser will return useful values only after this callback.
doctypeDecl in interface XmlHandlername - The document type name.pubid - The public identifier, or null if unspecified.sysid - The system identifier, or null if unspecified.XmlHandler.doctypeDecl(java.lang.String, java.lang.String, java.lang.String)public void attribute(java.lang.String name, java.lang.String value, boolean isSpecified)
Do nothing for now. Subclasses can override this method if they want to take a specific action.
attribute in interface XmlHandlername - The name of the attribute.value - The value of the attribute, or null if the attribute
is #IMPLIED.isSpecified - True if the value was specified, false if it
was defaulted from the DTD.XmlHandler.attribute(java.lang.String, java.lang.String, boolean)public void startElement(java.lang.String name)
Do nothing for now. Subclasses can override this method if they want to take a specific action.
startElement in interface XmlHandlername - The element type name.XmlHandler.startElement(java.lang.String)public void endElement(java.lang.String name)
Do nothing for now. Subclasses can override this method if they want to take a specific action.
endElement in interface XmlHandlername - The element type name.XmlHandler.endElement(java.lang.String)public void charData(char[] ch, int start, int length)
Do nothing for now. Subclasses can override this method if they want to take a specific action.
charData in interface XmlHandlerch - The character data.start - The starting position in the array.length - The number of characters available.XmlHandler.charData(char[], int, int)public void ignorableWhitespace(char[] ch, int start, int length)
Do nothing for now. Subclasses can override this method if they want to take a specific action.
ignorableWhitespace in interface XmlHandlerch - The literal whitespace characters.start - The starting position in the array.length - The number of whitespace characters available.XmlHandler.ignorableWhitespace(char[], int, int)public void processingInstruction(java.lang.String target, java.lang.String data)
Do nothing for now. Subclasses can override this method if they want to take a specific action.
processingInstruction in interface XmlHandlertarget - The target (the name at the start of the PI).data - The data, if any (the rest of the PI).XmlHandler.processingInstruction(java.lang.String, java.lang.String)public void error(java.lang.String message, java.lang.String url, int line, int column)
By default, print a message and throw an Error.
Subclasses can override this method if they want to do something different.
error in interface XmlHandlermessage - The error message.url - 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.XmlHandler.error(java.lang.String, java.lang.String, int, int)