OpenXml 文件格式设计和最佳实践

发布于 2024-07-19 14:08:33 字数 521 浏览 4 评论 0原文

各位,

我们一直在使用 System.IO.Packaging 中的 OpenXml API 来创建包含一些 Xml/二进制文件的包文件,因此该包的结构如下:

Package/
 -/DataFolder1/an xml file.xml
 -/DataFolder2/another xml file.xml
 -/Bin/other binar files

这已用于应用程序的 1.0 版本,并且它做得很好。

我们正处于 V2 的规划阶段,预计软件包结构将发生以下变化:

  • 软件包中可能会有其他文件

  • 软件包中可能会有一些修改现有文件的 Xml 架构(示例...新节点)

  • 现有文件的 Xml 架构可能有一些更改(例如......删除节点或更改数据类型)

我将不胜感激任何基于现实生活经验的建议,解决文件格式和应用程序本身之间的后向/前向可计算性,这样我们就可以让应用程序及其文件格式独立发展彼此身上。

Folks,

We have been using OpenXml APIs found in System.IO.Packaging for creating a package file that contains some Xml/Binary files, hence the package is some how structured as below:

Package/
 -/DataFolder1/an xml file.xml
 -/DataFolder2/another xml file.xml
 -/Bin/other binar files

This has been used for version 1.0 of the application and it is doing quite well.

We are in the planning phase of V2 anticipating the following changes in the package structure :

  • there might be additional files in the package

  • there might be some amendments in the Xml schema of existing files (example ... new nodes )

  • there might be some changes in the Xml schema of the existing files (example ... removing nodes or changing the data type)

I would appreciate any advice based on real life experience tackling backward/forward computability between the file formats and the application itself, so we can have both the application and its file format evolve independent on each other.

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

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

发布评论

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

评论(1

浊酒尽余欢 2024-07-26 14:08:33

如果不进一步了解您的申请,很难为您提供建议。 但是,可以通过添加包含版本号的属性来处理自定义 XML 的不同版本,或者(如果架构中发生重大更改)通过更改命名空间以包含新版本号。

如果您想了解 OpenXML 本身如何处理版本控制和可扩展性,我建议您阅读 OpenXML 规范的第 5 部分:

办公室开放
XML - 第 5 部分:标记兼容性和可扩展性

Without further knowing your application it is difficult to advise you. However, different versions of you custom XML could be handled by adding an attribute containing the version number or - if there have been major changes in the schema - by changing the namespace to contain a new version number.

If you want to have a look at how OpenXML itself deals with versioning and extensibility I suggest that you read Part 5 of the OpenXML specification:

Office Open
XML - Part 5: Markup Compatibility and Extensibility

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文