什么是设计XML模式的最佳做法? [英] What are best practices for designing XML schemas?

查看:125
本文介绍了什么是设计XML模式的最佳做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为业余软件开发人员(我还在学术界),我已经为XML文档写了几个模式。我经常遇到设计流感,造成丑陋的XML文档,因为我不完全确定XML的语义究竟是什么。



我的假设:

 < property>值< / property> 

property = value

 < property attribute =attval>值< / property> 

具有特殊描述符的属性,属性。

 < parent> 
< child>值< / child>
< / parent>

父级有一个特征child,其值为value。

 < tag /> 

标签是一个标志,或直接翻译成文字。我不确定这个。

 < parent> 
< child />
< / parent>

孩子描述父母。 child是一个标志或布尔值。我也不确定这个。



如果你想做一些代表笛卡尔坐标的东西,就会出现歧义:

 < coordinate x =0y =1 /> 

< coordinate> 0,1< / coordinate>

< coordinate>< x> 0< / x>< y> 1< / y>< / coordinate>

哪一个是最正确的?根据目前的XML架构设计概念,我会倾向于第三个,但我真的不知道。



简要描述如何有效设计xml模式的一些资源是什么?

解决方案

参见教程:





我也建议d:




As an amateur software developer (I'm still in academia) I've written a few schemas for XML documents. I routinely run into design flubs that cause ugly-looking XML documents because I'm not entirely certain what the semantics of XML exactly are.

My assumptions:

<property> value </property>

property = value

<property attribute="attval"> value </property>

A property with a special descriptor, the attribute.

<parent>
  <child> value </child>
</parent>

The parent has a characteristic "child" which has the value "value."

<tag />

"Tag" is a flag or it directly translates to text. I'm not sure on this one.

<parent>
  <child />
</parent>

"child" describes "parent." "child" is a flag or boolean. I'm not sure on this one, either.

Ambiguity arises if you want to do something like representing cartesian coordinates:

<coordinate x="0" y="1 />

<coordinate> 0,1 </coordinate>

<coordinate> <x> 0 </x> <y> 1 </y> </coordinate>

Which one of those is most correct? I would lean towards the third based upon my current conception of XML schema design, but I really don't know.

What are some resources that succinctly describe how to effectively design xml schemas?

解决方案

See the tutorial:

I also recommend:

这篇关于什么是设计XML模式的最佳做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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