|
www.sdmetrics.com | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--org.xml.sax.helpers.DefaultHandler
|
+--sdmetrics.model.XMIReader
Reads the XMI source file, processing it as specified by the
XMI transformation file. The UML model elements retrieved from the
file are stored in the ElementPool.
In the XMI, design information for one model element is spread across a number of XML elements in the XML tree. Therefore, a DOM XML parser would be a reasonable choice to use for processing an XMI file. DOM parsers read the entire tree and store it in memory. However, XMI files can become large, and we usually only need a fraction of the information contained in an XMI file, so this is not economical.
Therefore, a deliberate choice was made to use a SAX XML parser. The SAX parser reads one XML element at the time, and we need to keep track of the context in which an XML element is embedded. This is done using a stack holding the model elements to process, and the state at which processing is for each model element on the stack.
| Nested Class Summary | |
static interface |
XMIReader.ProgressMessageHandler
Interface with a callback method for the XMI reader to report progress to. |
| Constructor Summary | |
XMIReader(MetaModel mm,
XMITransformations trans,
ElementPool pool)
|
|
| Method Summary | |
void |
characters(char[] ch,
int start,
int length)
SAX Parser handler: process PCDATA with the currently active "ctext" trigger. |
void |
endDocument()
SAX parser handler: end of the document. |
void |
endElement(java.lang.String uri,
java.lang.String local,
java.lang.String raw)
SAX Parser handler: end of an XML element. |
void |
setProgressMessageHandler(XMIReader.ProgressMessageHandler handler)
Set the message handler for the XMI reader to report progress to. |
void |
startDocument()
SAX Parser handler: prepare parser for new document. |
void |
startElement(java.lang.String uri,
java.lang.String local,
java.lang.String raw,
org.xml.sax.Attributes attrs)
SAX Parser handler: process an XML element in the XMI source file. |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public XMIReader(MetaModel mm,
XMITransformations trans,
ElementPool pool)
mm - Metamodel on which the XMI transformations are based.trans - Object that knows the available XMI transformations.pool - The element pool to store the extracted model elements.| Method Detail |
public void setProgressMessageHandler(XMIReader.ProgressMessageHandler handler)
handler - The message handler.public void startDocument()
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandler
public void startElement(java.lang.String uri,
java.lang.String local,
java.lang.String raw,
org.xml.sax.Attributes attrs)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException - An error occurred during the evaluation of a
conditional XMI transformation.
public void characters(char[] ch,
int start,
int length)
characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandler
public void endElement(java.lang.String uri,
java.lang.String local,
java.lang.String raw)
throws org.xml.sax.SAXException
ElementPool and
pull it from the stack.
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException - The XML element holds relevant PCDATA for an unknown
attribute of the model elementpublic void endDocument()
endDocument in interface org.xml.sax.ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandler
|
www.sdmetrics.com | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||