public class EventDemo extends XmlApp
Usage: java EventDemo <url>
Or, use it as an applet, supplying the URL as the url
parameter.
XmlParser
,
XmlHandler
,
XmlApp
Constructor and Description |
---|
EventDemo() |
Modifier and Type | Method and Description |
---|---|
void |
attribute(java.lang.String name,
java.lang.String value,
boolean isSpecified)
Handle an attribute value assignment by printing an event.
|
void |
charData(char[] ch,
int start,
int length)
Handle character data by printing an event.
|
void |
doctypeDecl(java.lang.String name,
java.lang.String pubid,
java.lang.String sysid)
Handle a DOCTYPE declaration by printing an event.
|
void |
endDocument()
Handle the end of the document by printing an event.
|
void |
endElement(java.lang.String name)
Handle the end of an element by printing an event.
|
void |
endExternalEntity(java.lang.String systemId)
End an external entity.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Handle ignorable whitespace by printing an event.
|
static void |
main(java.lang.String[] args)
Entry point for an application.
|
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Handle a processing instruction by printing an event.
|
java.lang.Object |
resolveEntity(java.lang.String publicId,
java.lang.String systemId)
Resolve an entity and print an event.
|
void |
startDocument()
Handle the start of the document by printing an event.
|
void |
startElement(java.lang.String name)
Handle the start of an element by printing an event.
|
void |
startExternalEntity(java.lang.String systemId)
Begin an external entity.
|
public EventDemo()
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- The arguments. The first argument should be the urijava.lang.Exception
- If the parse failspublic java.lang.Object resolveEntity(java.lang.String publicId, java.lang.String systemId)
resolveEntity
in interface XmlHandler
resolveEntity
in class XmlApp
publicId
- 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 XmlHandler
startExternalEntity
in class XmlApp
systemId
- 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 XmlHandler
endExternalEntity
in class XmlApp
systemId
- 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()
startDocument
in interface XmlHandler
startDocument
in class XmlApp
XmlHandler.startDocument()
public void endDocument()
endDocument
in interface XmlHandler
endDocument
in class XmlApp
XmlHandler.endDocument()
public void doctypeDecl(java.lang.String name, java.lang.String pubid, java.lang.String sysid)
doctypeDecl
in interface XmlHandler
doctypeDecl
in class XmlApp
name
- 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)
attribute
in interface XmlHandler
attribute
in class XmlApp
name
- 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)
startElement
in interface XmlHandler
startElement
in class XmlApp
name
- The element type name.XmlHandler.startElement(java.lang.String)
public void endElement(java.lang.String name)
endElement
in interface XmlHandler
endElement
in class XmlApp
name
- The element type name.XmlHandler.endElement(java.lang.String)
public void charData(char[] ch, int start, int length)
charData
in interface XmlHandler
charData
in class XmlApp
ch
- 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)
ignorableWhitespace
in interface XmlHandler
ignorableWhitespace
in class XmlApp
ch
- 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)
processingInstruction
in interface XmlHandler
processingInstruction
in class XmlApp
target
- 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)