Xml 属性与 Xml 内部属性? [英] Xml attributes vs Xml inside properties?

查看:31
本文介绍了Xml 属性与 Xml 内部属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<块引用>

可能的重复:
如何设计在 xml 中存储复杂的对象设置
XML 属性 vs XML 元素

在决定是否应该这样做时使用的标准是什么:

Gaussian, 5

如果它是 #1,那么你会在括号里放什么?

我也不知道括号里面的值叫什么(Gaussian, 5):inside properties?

解决方案

  1. XML 标签内的值称为标签值.

  2. 您的第二个示例是如何不构造 XML 的示例(通常,对于任何数据存储,包括 XML,您不希望将 >1 个属性值捆绑到一个 blob 中,除非您永远得到保证永远不会单独使用/查询这 2 个值,并且捆绑的性能优势非常显着).

    应该是

<块引用>

<类型>高斯</类型><数量>5</数量></模糊>

两者之间的选择有时会很模糊,但是一个非常好IBM 提供了一套指导方针

Possible Duplicates:
How to design storing complex object settings in an xml
XML attribute vs XML element

What's the criteria to use when deciding whether something should be done like this:

<Blur Type="Gaussian", Amount=5></Blur>

or

<Blur>Gaussian, 5</Blur>

If it's #1, then what would you put inside the brackets?

Also I don't know what values inside the brackets are called (Gaussian, 5): inside properties?

解决方案

  1. The values inside the XML tags are called tag values.

  2. Your second example is an example of how NOT to structure XML (in general, for any data storage, XML included, you don't want to bundle >1 attribute value into one blob, unless you are forever guaranteed that the 2 values will never be used/queried separately and that performance benefits of bundling are significant).

    It should instead be

<Blur>
 <Type>Gaussian</Type>
 <Amount>5</Amount>
</Blur>

The choice between the two is sometimes blurred, but a very good set of guidelines exists from IBM

这篇关于Xml 属性与 Xml 内部属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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