XSD for XMI 2.1.1

余生颓废 提交于 2020-01-04 05:13:45

问题


I have to parse a XMI file (xmi version 2.1.1) using JAXB.

For that, I have to generate Java classes corresponding to a XMI file. So I need a shema definition of a xmi file to do that with the jxc tool.

I hope anyone know where I can find this file. Thanks in advance for help !

Edit : for more informations, there is an exemple of a xmi file (generated using modelio) :

<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmlns:uml="http://schema.omg.org/spec/UML/2.1.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmi:version="2.1" xmi:id="_1cUA4Pm5EeKGw-fe2JKgbQ" name="test">
  <eAnnotations xmi:id="_1cUA4fm5EeKGw-fe2JKgbQ" source="Objing">
    <contents xmi:type="uml:Property" xmi:id="_1cUA4vm5EeKGw-fe2JKgbQ" name="exporterVersion">
      <defaultValue xmi:type="uml:LiteralString" xmi:id="_1cUA4_m5EeKGw-fe2JKgbQ" value="2.2"/>
    </contents>
  </eAnnotations>
  <ownedComment xmi:type="uml:Comment" xmi:id="_1cUA5Pm5EeKGw-fe2JKgbQ">
    <body/>
  </ownedComment>
  <packagedElement xmi:type="uml:Class" xmi:id="_1cUA5fm5EeKGw-fe2JKgbQ" name="User">
    <ownedAttribute xmi:type="uml:Property" xmi:id="_1cUA5vm5EeKGw-fe2JKgbQ" name="login" visibility="private" isUnique="false" isReadOnly="true">
      <type xmi:type="uml:PrimitiveType" href="http://schema.omg.org/spec/UML/2.1.1/uml.xml#String"/>
    </ownedAttribute>
    <ownedAttribute xmi:type="uml:Property" xmi:id="_1cUA5_m5EeKGw-fe2JKgbQ" name="id" visibility="private" isUnique="false" isReadOnly="true">
      <type xmi:type="uml:PrimitiveType" href="http://schema.omg.org/spec/UML/2.1.1/uml.xml#Integer"/>
    </ownedAttribute>
  </packagedElement>
  <packagedElement xmi:type="uml:Association" xmi:id="_1cUA6Pm5EeKGw-fe2JKgbQ" memberEnd="_1cUA6fm5EeKGw-fe2JKgbQ _1cUA7fm5EeKGw-fe2JKgbQ">
    <ownedEnd xmi:type="uml:Property" xmi:id="_1cUA6fm5EeKGw-fe2JKgbQ" type="_1cUA6_m5EeKGw-fe2JKgbQ" association="_1cUA6Pm5EeKGw-fe2JKgbQ">
      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_1cUA6vm5EeKGw-fe2JKgbQ"/>
    </ownedEnd>
  </packagedElement>
  <packagedElement xmi:type="uml:Class" xmi:id="_1cUA6_m5EeKGw-fe2JKgbQ" name="Group">
    <ownedAttribute xmi:type="uml:Property" xmi:id="_1cUA7Pm5EeKGw-fe2JKgbQ" name="label" visibility="private" isUnique="false" isReadOnly="true">
      <type xmi:type="uml:PrimitiveType" href="http://schema.omg.org/spec/UML/2.1.1/uml.xml#String"/>
    </ownedAttribute>
    <ownedAttribute xmi:type="uml:Property" xmi:id="_1cUA7fm5EeKGw-fe2JKgbQ" name="user" type="_1cUA5fm5EeKGw-fe2JKgbQ" isReadOnly="true" aggregation="shared" association="_1cUA6Pm5EeKGw-fe2JKgbQ">
      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_1cUA7vm5EeKGw-fe2JKgbQ" value="*"/>
      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_1cUA7_m5EeKGw-fe2JKgbQ"/>
    </ownedAttribute>
  </packagedElement>
</uml:Model>

回答1:


You can find the XMI XSD on the OMG website XMI XSD 2.1.1 but you will also need the UML Schema and the MOF Schema.

A better way to read and write UML XMI files is to use the Eclipse UML implementation. It can easily be used outside Eclipse in a simple Java program : see



来源:https://stackoverflow.com/questions/17967112/xsd-for-xmi-2-1-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!