REPO MIGRATED TO https://github.com/moosetechnology/xmi-analyzer
I no longer maintain this project, please follow the link above.
XMI Analyzer is a (prototype) utility assisting in analyzing XMI files.
Sponsored by Synectique
Note that XMI is a subset of XML with rather specific rulues.
- For free-form-ish XML you might be interested in https://github.com/peteruhnak/xml-magritte-generator
- For generic XMI see https://github.com/OpenPonk/xmi
- this project should migrate to use that at some point
Metacello new
baseline: 'XMIAnalyzer';
repository: 'github://peteruhnak/xmi-analyzer/repository';
load.
Instead of operating on the DOM this tool will generate appropriate classes for the individual node types and will instantiate them from the XMI.
The instantiation includes:
- basic type inference (booleans, numbers, strings, IDREF(s))
- reference resolution
- instead of having string IDs in the DOM, the instances will have proper object references
"get an instance of DOM tree"
"dom := XMLDOMParser parse: FileLocator home asFileReference / 'prog/xmi/examples/smr2.xml'."
dom := XMIAnalyzer sampleStateMachineXmi.
"Generate the necessary classes. Prefix will be added before all generated classes."
XMIAnalyzer createClassesFor: dom prefixed: 'SMX' in: 'MyGeneratedClasses'.
"Create the instances in the generated classes."
instance := XMIAnalyzer createInstanceOf: dom prefixed: 'SMX'.
"Inspect the instance"
instance inspect.
"Apply a simple Mondrian demo visualization (requires Roassal)"
(XMIAnalyzer sampleStateMachineVisualization: instance) open.
In-image example is available after running XMIAnalyzer>>exampleStateMachineScenario
Example usage on some XMI:
Original XMI
Generated classes for the tree
Inspecting the instantiated model
Simple Roassal visualization of the content.