EMF的一些总结(3)——关于Resource的实现

Resource通过两种方式实现XML和XMI。
1.XML
实现Resource存储的重要方法是save, 只有在方法eIsSet()返回true时,相关的属性和引用才会被序列化到xml中。对于存储的xml文件的格式可以通过设置OPTION_XML_MAP属性来完成,如下面原文:

There are several reasons why you might want to use OPTION_XML_MAP when saving a resource:

  1. You want to save your data so that it conforms to a particular XML Schema.

  2. You have changed your model, and you want the resource to produce XML documents that will work with the old version of the model.

  3. You want to design your own XML format without changing your model.


2.XMI
XMI和XML基本相同,XMIResourceImpl就是XMLResourceImpl的简单继承,只是在引用objects时使用XMI IDs
posted @ 2006-05-07 16:52  Android,服务端,移动互联网  阅读(502)  评论(0编辑  收藏  举报