|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--utils.ptplot5_2.com.microstar.xml.HandlerBase | +--utils.ptplot5_2.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 | |
static java.lang.String |
PlotML_DTD_1
The standard PlotML DTD, represented as a string. |
Constructor Summary | |
PlotBoxMLParser(PlotBox plot)
Construct an parser to parse commands for the specified plot object. |
Method Summary | |
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. |
void |
parse(java.net.URL base,
java.io.Reader reader)
Parse the given stream as a PlotML file. |
void |
parse(java.net.URL base,
java.lang.String text)
Parse the given text as PlotML. |
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 utils.ptplot5_2.com.microstar.xml.HandlerBase |
doctypeDecl, endExternalEntity, ignorableWhitespace, processingInstruction |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.lang.String PlotML_DTD_1
Constructor Detail |
public PlotBoxMLParser(PlotBox plot)
plot
- The plot object to which to apply the commands.Method Detail |
public void attribute(java.lang.String name, java.lang.String value, boolean specified) throws XmlException
attribute
in interface XmlHandler
attribute
in class HandlerBase
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.
XmlException
- If the name or value is null.com.microstar.xml.XmlHandler#attribute
public void charData(char[] chars, int offset, int length)
charData
in interface XmlHandler
charData
in class HandlerBase
chars
- The character data.offset
- The starting position in the array.length
- The number of characters available.com.microstar.xml.XmlHandler#charData
public void endDocument() throws java.lang.Exception
endDocument
in interface XmlHandler
endDocument
in class HandlerBase
java.lang.Exception
- Derived methods may throw exceptions.com.microstar.xml.XmlHandler#endDocument
public void endElement(java.lang.String elementName) throws java.lang.Exception
endElement
in interface XmlHandler
endElement
in class HandlerBase
elementName
- The element type name.
java.lang.Exception
- Derived methods may throw exceptions.com.microstar.xml.XmlHandler#endElement
public void error(java.lang.String message, java.lang.String sysid, int line, int column) throws XmlException
error
in interface XmlHandler
error
in class HandlerBase
message
- The error message.line
- The approximate line number of the error.column
- The approximate column number of the error.
XmlException
- If called.com.microstar.xml.XmlHandler#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.
java.lang.Exception
- If the parser fails.public void parse(java.net.URL base, java.io.Reader reader) throws java.lang.Exception
reader
- The stream from which to read XML.
java.lang.Exception
- If the parser fails.public void parse(java.net.URL base, java.lang.String text) throws java.lang.Exception
text
- The PlotML data.
java.lang.Exception
- If the parser fails.public java.lang.Object resolveEntity(java.lang.String publicID, java.lang.String systemID)
resolveEntity
in interface XmlHandler
resolveEntity
in class HandlerBase
com.microstar.xml.XmlHandler#resolveEntity
public void startDocument()
startDocument
in interface XmlHandler
startDocument
in class HandlerBase
com.microstar.xml.XmlHandler#startDocument
public void startElement(java.lang.String elementName) throws XmlException
startElement
in interface XmlHandler
startElement
in class HandlerBase
elementName
- The element type name.
XmlException
- If the element produces an error
in constructing the model.com.microstar.xml.XmlHandler#startElement
public void startExternalEntity(java.lang.String systemId)
startExternalEntity
in interface XmlHandler
startExternalEntity
in class HandlerBase
systemId
- The URI for the external entity.com.microstar.xml.XmlHandler#startExternalEntity
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |