Class EventDemo

java.lang.Object
  extended by XmlApp
      extended by EventDemo
All Implemented Interfaces:
XmlHandler
Direct Known Subclasses:
ReaderDemo, StreamDemo

public class EventDemo
extends XmlApp

Demonstration application showing ?lfred's event stream.

Usage: java EventDemo <url>

Or, use it as an applet, supplying the URL as the url parameter.

See Also:
XmlParser, XmlHandler, XmlApp

Field Summary
 
Fields inherited from class XmlApp
isApplet, parser
 
Constructor Summary
EventDemo()
           
 
Method Summary
 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.
 
Methods inherited from class XmlApp
error
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventDemo

public EventDemo()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Entry point for an application.

Throws:
java.lang.Exception

resolveEntity

public java.lang.Object resolveEntity(java.lang.String publicId,
                                      java.lang.String systemId)
Resolve an entity and print an event.

Specified by:
resolveEntity in interface XmlHandler
Overrides:
resolveEntity in class XmlApp
Parameters:
publicId - The public identifier, or null if none was supplied.
systemId - The system identifier.
Returns:
The replacement system identifier, or null to use the default.
See Also:
XmlHandler.resolveEntity(java.lang.String, java.lang.String)

startExternalEntity

public void startExternalEntity(java.lang.String systemId)
Description copied from interface: XmlHandler
Begin an external entity.

Æ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.

Specified by:
startExternalEntity in interface XmlHandler
Overrides:
startExternalEntity in class XmlApp
Parameters:
systemId - The URI of the external entity that is starting.
See Also:
XmlHandler.endExternalEntity(java.lang.String), XmlHandler.resolveEntity(java.lang.String, java.lang.String)

endExternalEntity

public void endExternalEntity(java.lang.String systemId)
Description copied from interface: XmlHandler
End an external entity.

Æ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.

Specified by:
endExternalEntity in interface XmlHandler
Overrides:
endExternalEntity in class XmlApp
Parameters:
systemId - The URI of the external entity that is ending.
See Also:
XmlHandler.startExternalEntity(java.lang.String), XmlHandler.resolveEntity(java.lang.String, java.lang.String)

startDocument

public void startDocument()
Handle the start of the document by printing an event.

Specified by:
startDocument in interface XmlHandler
Overrides:
startDocument in class XmlApp
See Also:
XmlHandler.startDocument()

endDocument

public void endDocument()
Handle the end of the document by printing an event.

Specified by:
endDocument in interface XmlHandler
Overrides:
endDocument in class XmlApp
See Also:
XmlHandler.endDocument()

doctypeDecl

public void doctypeDecl(java.lang.String name,
                        java.lang.String pubid,
                        java.lang.String sysid)
Handle a DOCTYPE declaration by printing an event.

Specified by:
doctypeDecl in interface XmlHandler
Overrides:
doctypeDecl in class XmlApp
Parameters:
name - The document type name.
pubid - The public identifier, or null if unspecified.
sysid - The system identifier, or null if unspecified.
See Also:
XmlHandler.doctypeDecl(java.lang.String, java.lang.String, java.lang.String)

attribute

public void attribute(java.lang.String name,
                      java.lang.String value,
                      boolean isSpecified)
Handle an attribute value assignment by printing an event.

Specified by:
attribute in interface XmlHandler
Overrides:
attribute in class XmlApp
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.
See Also:
XmlHandler.attribute(java.lang.String, java.lang.String, boolean)

startElement

public void startElement(java.lang.String name)
Handle the start of an element by printing an event.

Specified by:
startElement in interface XmlHandler
Overrides:
startElement in class XmlApp
Parameters:
name - The element type name.
See Also:
XmlHandler.startElement(java.lang.String)

endElement

public void endElement(java.lang.String name)
Handle the end of an element by printing an event.

Specified by:
endElement in interface XmlHandler
Overrides:
endElement in class XmlApp
Parameters:
name - The element type name.
See Also:
XmlHandler.endElement(java.lang.String)

charData

public void charData(char[] ch,
                     int start,
                     int length)
Handle character data by printing an event.

Specified by:
charData in interface XmlHandler
Overrides:
charData in class XmlApp
Parameters:
ch - The character data.
start - The starting position in the array.
length - The number of characters available.
See Also:
XmlHandler.charData(char[], int, int)

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
Handle ignorable whitespace by printing an event.

Specified by:
ignorableWhitespace in interface XmlHandler
Overrides:
ignorableWhitespace in class XmlApp
Parameters:
ch - The literal whitespace characters.
start - The starting position in the array.
length - The number of whitespace characters available.
See Also:
XmlHandler.ignorableWhitespace(char[], int, int)

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
Handle a processing instruction by printing an event.

Specified by:
processingInstruction in interface XmlHandler
Overrides:
processingInstruction in class XmlApp
Parameters:
target - The target (the name at the start of the PI).
data - The data, if any (the rest of the PI).
See Also:
XmlHandler.processingInstruction(java.lang.String, java.lang.String)