Peter,
If I name your sample file abc.xmi, I can use "Open With->UML Model
Editor" and it loads with errors complaining about the bad enum values
but this version with that problem corrected loads fine:
<?xml version="1.0" encoding="windows-1252"?>
<xmi:XMI xmi:version="2.1"
xmlns:uml="http://schema.omg.org/spec/UML/2.1"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1">
<xmi:Documentation exporter="Enterprise Architect"
exporterVersion="6.5"/>
<uml:Model xmi:type="uml:Model" name="EA_Model" visibility="public">
<packagedElement xmi:type="uml:Package"
xmi:id="EAPK_E6C5F87D_2FCE_4328_9935_7900462383E2" name="V" visibility="public">
<packagedElement xmi:type="uml:Class"
xmi:id="EAID_6332E5F5_C760_4f47_A61B_2F5F6DD39B74" name="KlasaA"
visibility="public"/>
</packagedElement>
</uml:Model>
</xmi:XMI>
Be sure to load and save using the right type of resource
implementation; there's one for reading UML serialized as standard XMI
and one for saving as .uml, which will create UUIDs and produce xmi:ids
for them.
Peter Jackson wrote:
Hello,
I've searched through emf and this newsgroup, still not found the
answer.
I'm using UML2 2.1M3 and EMF 2.3.0.
As I try to import xmi file created by Enterprise Architect following
error occurs:
Exception in thread "main"
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException:
org.eclipse.emf.ecore.xmi.PackageNotFoundE
xception: Package with uri 'http://schema.omg.org/spec/XMI/2.1' not
found. (file:/c:/model_uml21_xmi21.xml, 3, 76)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:307)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:268)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:390)
at src.Test2.main(Test2.java:44)
Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
with uri 'http://schema.omg.org/spec/XMI/2.1' not found.
(file:/c:/model_uml21_
xmi21.xml, 3, 76)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(XMLHandler.java:2342)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefix(XMLHandler.java:2180)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1137)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1239)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:877)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:82)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:860)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at
org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:179)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:179)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1109)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:915)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:249)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:264)
... 2 more
My xmi file (exported from Enterprise Architect 6.5 in UML 2.1 XMI 2.1)
looks like this:
<?xml version="1.0" encoding="windows-1252"?>
<xmi:XMI xmi:version="2.1"
xmlns:uml="http://schema.omg.org/spec/UML/2.1"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1">
<xmi:Documentation exporter="Enterprise Architect"
exporterVersion="6.5"/>
<uml:Model xmi:type="uml:Model" name="EA_Model"
visibility="vis_public">
<packagedElement xmi:type="uml:Package"
xmi:id="EAPK_E6C5F87D_2FCE_4328_9935_7900462383E2" name="V"
visibility="vis_public">
<packagedElement xmi:type="uml:Class"
xmi:id="EAID_6332E5F5_C760_4f47_A61B_2F5F6DD39B74" name="KlasaA"
visibility="vis_public"/>
</packagedElement>
</uml:Model>
</xmi:XMI>
When I created dynamic model using emf, similiar to the one above
serialized into following form:
<?xml version="1.0" encoding="ASCII"?>
<uml:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML" name="EA_Model">
<packagedElement xsi:type="uml:Package" name="V">
<packagedElement xsi:type="uml:Class" name="KlasaA"/>
</packagedElement>
</uml:Model>
I can change my model manually but that's not the point. Could anyone
point me to the right direction with some questions:
1. At first, do I get it right ? EMF + UML2 => can import UML 2.0
models exported to XMI ?
2. If 1 is correct, where are differences between those xmi files
coming from ? ( root element missing, namespaces URIs, visibility
kinds, no xmi.id in generated file )
3. Did anyone succeed in importing to emf xmi model from Enterprise
Architect or xmi model exported by any other uml tool ?
Thanks in advance
Peter Jackson
|