为什么我会选择在关系数据库中存储和操作 XML? [英] Why would I ever choose to store and manipulate XML in a relational database?

查看:40
本文介绍了为什么我会选择在关系数据库中存储和操作 XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现代 RDBMS 支持 XML 列类型和用于在存储过程中处理 XML 的功能.从历史上看,我总是将分层数据(无论是 OO 对象还是 XML)映射到关系表.鉴于对 XML 的广泛数据库支持,我应该改变我的方式吗?

Modern RDBMS's have support for XML column types and functionality for dealing with XML in stored procedures. Historically I would always have mapped hierarchical data (whether of OO objects or XML) to relational tables. Given the widespread database support for XML should I change my ways?

推荐答案

我有一个很好的现实例子.我的一个客户经常从他们的供应商那里收到一个包含一些重要数据的 XML 文件.它嵌套很深.他们需要将它与以前的 XML 文件进行比较,以查看发生了什么变化.如果数据库中没有 XML 支持,我必须构建一个工具来遍历 XML 节点并在关系数据库的表中查找匹配项.我可以使用一些 XML-XML 比较工具,但是一些检查与一些不是来自 XML 文件的其他数据有关,我需要将所有这些连接在一起.好的,所有这些都不是什么大问题,但仍然 - 使用 XML 数据库,您可以获得开箱即用的功能.

I have a good real-life example. One of my clients receives an XML file from their suppliers very often with some important data. It is deeply nested. They need to compare it with the previous XML file to see what has changed. Without XML support in database, I had to build a tool that iterates through XML nodes and looks for matches in the tables of relational database. I could use some XML-XML comparison tool, but some of the checks relate to some other data that did not come from XML file and I need to join all that together. Ok, all of this is not that big deal, but still - with XML databases you get that functionality out-of-the-box.

这篇关于为什么我会选择在关系数据库中存储和操作 XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆