public class XMLTraceParser extends XMLParser implements TraceFileReader
XML document
that represents a trace of execution of a
Topology
.
This class is used through its parent class XMLParser
. It overrides parseRootElement(Element)
to
interpret the document as a topology
and a set of events
on that
topology.
The class does not create an new topology. It populates a TracePlayer
passed to the constructor.XMLParser.ElementVisitor, XMLParser.ParserException
Constructor and Description |
---|
XMLTraceParser(FileAsStream fileAsStream,
boolean validateDocument)
Creates a parser for the given
TracePlayer . |
Modifier and Type | Method and Description |
---|---|
protected FileAsStream |
getFileAccessor() |
void |
parse(String filename,
TracePlayer tracePlayer)
Loads and parses the document contained in (@code filename}.
|
void |
parseRootElement(Element element)
Interprets the root element of the document.
|
static void |
parseTraceElement(Element element,
TracePlayer tp)
|
getVersion, mapElementChildrenOf, parse, parse, parseFromString
public XMLTraceParser(FileAsStream fileAsStream, boolean validateDocument)
TracePlayer
.fileAsStream
- the TracePlayer
that is populated by the parser.validateDocument
- enable or disable the validation of the document using an XSD schema.public void parse(String filename, TracePlayer tracePlayer) throws XMLParser.ParserException
parse
in interface TraceFileReader
filename
- the name of the file to read.tracePlayer
- the TracePlayer
that is populated by the parser.ParserException
- raised if an IO error occurs or if the XML document is malformed.XMLParser.ParserException
protected FileAsStream getFileAccessor()
public void parseRootElement(Element element) throws XMLParser.ParserException
XMLParser
version
attribute of the root element.parseRootElement
in class XMLParser
element
- the element to be interpreted.XMLParser.ParserException
- raised if an IO error occurs or if the XML document is malformed.public static void parseTraceElement(Element element, TracePlayer tp) throws XMLParser.ParserException
element
- the root element of the XML tree describing the trace.tp
- the TracePlayer
popuylated by the parserParserException
- is raised if the given document
is malformed.XMLParser.ParserException