我必須使用JAXB解析XMI文件(xmi version 2.1.1)。XSD for XMI 2.1.1
爲此,我必須生成對應於XMI文件的Java類。 所以我需要一個xmi文件的shema定義來使用jxc工具。
我希望有人知道我在哪裏可以找到這個文件。 在此先感謝您的幫助!
編輯:更多的信息,有一個XMI文件的爲例(使用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>
您的XMI文件包含什麼? UML?哪個版本? – Christian
啊,在這種情況下,Xaelis的答案似乎很好 – Christian