|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.microstar.xml.HandlerBase | +--ptolemy.plot.plotml.PlotBoxMLParser
This class constructs a plot from specifications in PlotML (Plot Markup Language), which is an XML language. This class supports only the subset that applies to the PlotBox base class. It ignores all other elements in the DTD. The class contains an instance of the Microstar Ælfred XML parser and implements callback methods to interpret the parsed XML. The way to use this class is to construct it with a reference to a PlotBox object and then call its parse() method.
Field Summary | |
protected java.util.Hashtable |
_attributes
Attributes associated with an entity. |
protected java.lang.StringBuffer |
_currentCharData
The current character data for the current element. |
protected XmlParser |
_parser
The parser. |
protected PlotBox |
_plot
The plot object to which to apply commands. |
Constructor Summary | |
protected |
PlotBoxMLParser()
Protected constructor allows derived classes to set _plot differently. |
|
PlotBoxMLParser(PlotBox plot)
Construct an parser to parse commands for the specified plot object. |
Method Summary | |
protected void |
_checkForNull(java.lang.Object object,
java.lang.String message)
If the argument is null, throw an exception with the given message. |
protected java.lang.String |
_currentExternalEntity()
Get the the URI for the current external entity. |
void |
attribute(java.lang.String name,
java.lang.String value,
boolean specified)
Handle an attribute assignment that is part of an XML element. |
void |
charData(char[] chars,
int offset,
int length)
Handle character data. |
void |
endDocument()
End the document. |
void |
endElement(java.lang.String elementName)
End an element. |
void |
error(java.lang.String message,
java.lang.String sysid,
int line,
int column)
Indicate a fatal XML parsing error. |
void |
parse(java.net.URL base,
java.io.InputStream input)
Parse the given stream as a PlotML file. |
java.lang.Object |
resolveEntity(java.lang.String publicID,
java.lang.String systemID)
Resolve an external entity. |
void |
startDocument()
Start a document. |
void |
startElement(java.lang.String elementName)
Start an element. |
void |
startExternalEntity(java.lang.String systemId)
Handle the start of an external entity. |
Methods inherited from class com.microstar.xml.HandlerBase |
doctypeDecl,
endExternalEntity,
ignorableWhitespace,
processingInstruction |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.util.Hashtable _attributes
protected java.lang.StringBuffer _currentCharData
protected XmlParser _parser
protected PlotBox _plot
Constructor Detail |
public PlotBoxMLParser(PlotBox plot)
plot
- The plot object to which to apply the commands.protected PlotBoxMLParser()
Method Detail |
public void attribute(java.lang.String name, java.lang.String value, boolean specified) throws XmlException
name
- The name of the attribute.value
- The value of the attribute, or null if the attribute
is #IMPLIED
and not specified.specified
- True if the value is specified, false if the
value comes from the default value in the DTD rather than from
the XML file.public void charData(char[] chars, int offset, int length)
chars
- The character data.offset
- The starting position in the array.length
- The number of characters available.public void endDocument() throws java.lang.Exception
XmlHandler.endDocument()
public void endElement(java.lang.String elementName) throws java.lang.Exception
elementName
- The element type name.public void error(java.lang.String message, java.lang.String sysid, int line, int column) throws XmlException
message
- The error message.systemId
- The URI of the tntity that caused the error.line
- The approximate line number of the error.column
- The approximate column number of the error.public void parse(java.net.URL base, java.io.InputStream input) throws java.lang.Exception
PlotBoxMLParser parser = new PlotBoxMLParser(); URL docBase = getDocumentBase(); URL xmlFile = new URL(docBase, modelURL); parser.parse(xmlFile.openStream());A variety of exceptions might be thrown if the parsed data does not represent a valid PlotML file.
input
- The stream from which to read XML.public java.lang.Object resolveEntity(java.lang.String publicID, java.lang.String systemID)
publicId
- The public identifier, or null if none was supplied.systemId
- The system identifier.public void startDocument()
XmlHandler.startDocument()
public void startElement(java.lang.String elementName) throws XmlException
elementName
- The element type name.public void startExternalEntity(java.lang.String systemId)
systemId
- The URI for the external entity.protected void _checkForNull(java.lang.Object object, java.lang.String message) throws XmlException
object
- The reference to check for null.message
- The message to issue if the reference is null.protected java.lang.String _currentExternalEntity()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |