[mdr-users] XML Namespaces and Custom Metamodels
Pieter Van Gorp <[email protected]> Thu, 4 Aug 2005 15:53:54 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.user |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
how can I set the XML namespace to be used in the XMI for models
conforming to my own metamodel?
I've created a metamodel for creating traceability links across UML
models. Therefore, my metamodel clusters the UML metamodel (more info
on http://www.fots.ua.ac.be/motmot/docs/traceability-p3.php). The
problem is that when I serialize a traceability model to XMI, only
"UML" is defined as an XML namespace and "tracing" (which should be
the namespace for elements in the clustering model) is undefined.
This leads to exceptions when the XMI is read in again. For example:
org.netbeans.lib.jmi.util.DebugException: Element name cannot be
resolved, unknown package: tracing.Node
at org.netbeans.lib.jmi.xmi.XmiContext.resolveElementName(XmiContext.java:527)
at org.netbeans.lib.jmi.xmi.XmiElement$Content.startSubElement(XmiElement.java:354)
at org.netbeans.lib.jmi.xmi.XmiSAXReader.startElement(XmiSAXReader.java:223)
XMI of the erraneous traceability model:
<?xml version = '1.0' encoding = 'ISO-8859-1' ?>
<XMI xmi.version = '1.2' xmlns:UML = 'org.omg.xmi.namespace.UML'
timestamp = 'Thu Aug 04 15:51:23 CEST 2005'>
<XMI.header>
<XMI.documentation>
<XMI.exporter>Netbeans XMI Writer</XMI.exporter>
<XMI.exporterVersion>1.0</XMI.exporterVersion>
</XMI.documentation>
</XMI.header>
<XMI.content>
<tracing.Node xmi.id = 'a1' role = 'reference to a1'>
<tracing.Node.trace>
<tracing.Trace xmi.idref = 'a2'/>
</tracing.Node.trace>
<tracing.Node.content>
<UML:Attribute xmi.idref = 'a3'/>
</tracing.Node.content>
</tracing.Node>
<tracing.Node xmi.id = 'a4' role = 'reference to a2'>
<tracing.Node.trace>
<tracing.Trace xmi.idref = 'a2'/>
</tracing.Node.trace>
<tracing.Node.content>
<UML:Attribute xmi.idref = 'a5'/>
</tracing.Node.content>
</tracing.Node>
<tracing.Trace xmi.id = 'a2'>
<tracing.Trace.node>
<tracing.Node xmi.idref = 'a1'/>
<tracing.Node xmi.idref = 'a4'/>
</tracing.Trace.node>
</tracing.Trace>
</XMI.content>
</XMI>
I thought it may be due to a missing tag in the specification of my
metamodel but couldn't find a solution on the website for the UML
profile for MOF...
Thanks in advance for your help,
--
Pieter Van Gorp
Teaching and Research Assistant
FOrmal Techniques in Software engineering (FOTS)
University of Antwerp
Middelheimlaan 1
2020 Antwerpen - Belgium
Office: G.304
Phone: +32 3 265 38 71
Fax: +32 3 265 37 77
http://www.fots.ua.ac.be/~pvgorp/research/
http://motmot.sourceforge.net/