需要通过java代码读取XMI文件,而不使用任何工具(如argouml)

发布于 2024-09-23 23:46:55 字数 107 浏览 0 评论 0原文

有什么方法可以通过编写java代码而不是使用其他工具(如EMF、MDI等)来读取XMI文件?我想编写一个java程序,它可以读取xmi文件中的所有类和属性,然后加载到内存中。

请帮忙。

Is there any way i can read an XMI file by writing java code rather that using nay tool(like EMF, MDI etc)? I want to write a java program which can read all the classes and attributes in an xmi file and then load then in the memory.

Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眉目亦如画i 2024-09-30 23:46:55

这很容易。您只需要编写一个 Java 程序来解析 XML 文件并查找 UML 模型的类(名为“Class”的 XML 元素)。属性显示为嵌套元素(Classifier.feature,然后是 Attribute)

That´s quite easy. You just need to write a Java program that parses the XML File and look for the classes of the UML model (XML elements named "Class"). Attributs appear as nested elements (Classifier.feature and then Attribute)

如痴如狂 2024-09-30 23:46:55

你有3个选择。

  • 使用 JMI 规范的实现(到目前为止还没有找到)
  • 使用 ECore 作为lib(或者它真的依赖于 eclipse 吗?)
  • 使用一些 XML 阅读器/库解析 XML,然后提取您需要的内容

You have 3 options.

  • Use an implementation of the JMI specification (didn't find any until now)
  • use ECore as a lib (or is that one really eclipse-dependant?)
  • Parse the XML with some XML-reader/-library and just pull what you need
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文