0

Let's consider a semi-structured data model like XML and a structured one like the well known relational data model.

When is better to store the data in a XML database instead of a relational dbms ?

It obviously depend on the kind of data that we want to manage, but is there a specific kind of data for which it is definitely better to use a XML database?

The only advantage I can see with XML is that we can save memory if we have entities with a lot of null values which change only in respect to the value of an attribute 'type'. In a XML file we simply do not store the attributes that would be null in a relational table.

It seems to me that there is a lot more to that, but I am clueless.

4

1 回答 1

1

半结构化数据模型仅适用于一种数据:半结构化数据。

也就是说,当您具有以下形式的结构化数据时:

<node>
    <text>foo</text>
    <bold>
        <text>bar</text>
    </bold>
    <text>baz</text>
</node>

那么通过去除冗余的“文本”节点来压缩表示是有意义的:

<node>
    foo
    <bold>bar</bold>
    baz
</node>

这就是 XML 通过严格结构化的数据表示为您提供的全部内容。本质上,这就是文档(尤其是 HTML)。

请注意,这仅与表示有关。上述两种数据模型是等价的,都用树表示。

于 2012-12-30T13:07:07.857 回答