构建XML模型时,是优先将数据作为节点还是优先作为属性??

blackbsa 2003-10-16 03:26:37
例如
1.优先考虑成节点
<method>
<name>tan</name>
<parameters>
<parmeter>
<type/>
<name>number</name>
</parmeter>
</parameters>
<description>Returns the tangent of a number.</description>
<access>public</access>
</method>
2.优先考虑成属性
<method name="tan" access="public">
<parameters>
<parmeter type="" name="number"></parmeter>
</parameters>
<description>Returns the tangent of a number.</description>
</method>
...全文
34 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
cybernaute 2003-10-17
  • 打赏
  • 举报
回复
节点
saucer 2003-10-17
  • 打赏
  • 举报
回复
here are some guidelines:

if an entity has a structure, you have to model it as an Element node

if an entity is atomic and has no future potential to contain other information, model it as an Attribute node

if an entity is metadata and atomic, model it as an Attribute model

otherwise, model it as an Element node
heaven119 2003-10-16
  • 打赏
  • 举报
回复
是作为节点还是作为属性有一个原则:
属性在大多时候很像数据库中的"主键",如果你不是为了查找那个节点的话,最好把它设为节点.
萝卜波 2003-10-16
  • 打赏
  • 举报
回复
节点好
wolf004 2003-10-16
  • 打赏
  • 举报
回复
考虑节点!写代码起来放便!
FlySpace 2003-10-16
  • 打赏
  • 举报
回复
数据优先以节点形式存放,检索速度快,节点是按ID检索的,属性是按名称检索的,建议最好少用属性,速度慢!

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧