Package com.microstar.xml.demo
Class EventDemo
- java.lang.Object
-
- com.microstar.xml.demo.XmlApp
-
- com.microstar.xml.demo.EventDemo
-
- All Implemented Interfaces:
XmlHandler
- Direct Known Subclasses:
ReaderDemo
,StreamDemo
public class EventDemo extends XmlApp
Demonstration application showing Æfred's event stream.Usage:
java EventDemo <url>
Or, use it as an applet, supplying the URL as the
url
parameter.- Since:
- Ptolemy II 0.2
- Version:
- 1.1
- Author:
- Copyright (c) 1997, 1998 by Microstar Software Ltd.;, written by David Megginson <dmeggins@microstar.com>
- See Also:
XmlParser
,XmlHandler
,XmlApp
-
-
Constructor Summary
Constructors Constructor Description EventDemo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
Entry point for an application.- Parameters:
args
- The arguments. The first argument should be the uri- Throws:
java.lang.Exception
- If the parse fails
-
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 interfaceXmlHandler
- Overrides:
resolveEntity
in classXmlApp
- 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 interfaceXmlHandler
- Overrides:
startExternalEntity
in classXmlApp
- 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 interfaceXmlHandler
- Overrides:
endExternalEntity
in classXmlApp
- 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 interfaceXmlHandler
- Overrides:
startDocument
in classXmlApp
- See Also:
XmlHandler.startDocument()
-
endDocument
public void endDocument()
Handle the end of the document by printing an event.- Specified by:
endDocument
in interfaceXmlHandler
- Overrides:
endDocument
in classXmlApp
- 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 interfaceXmlHandler
- Overrides:
doctypeDecl
in classXmlApp
- 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 interfaceXmlHandler
- Overrides:
attribute
in classXmlApp
- Parameters:
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.- 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 interfaceXmlHandler
- Overrides:
startElement
in classXmlApp
- 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 interfaceXmlHandler
- Overrides:
endElement
in classXmlApp
- 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 interfaceXmlHandler
- Overrides:
charData
in classXmlApp
- 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 interfaceXmlHandler
- Overrides:
ignorableWhitespace
in classXmlApp
- 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 interfaceXmlHandler
- Overrides:
processingInstruction
in classXmlApp
- 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)
-
-