如何更好地编写我的XML? [英] How to write my XML better?

查看:85
本文介绍了如何更好地编写我的XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我刚接触XML.

我想编写一个关于Reactor的XML文件.
反应器包含一些零件.
例如.一个装有胸骨和垫片的鞍座,也许我可以这样写:

Hello everyone,

I am new to XML.

I want to write an XML file about a Reactor.
The reactor contains some parts.
For example. a saddle contains sternum and shim-plate, maybe I can write like below:

<saddle>
<sternum></sternum>
<shim-plate></shim-plate>
</saddle>


此外,鞍具拥有其ID,胸骨和垫片板也拥有其ID,另一方面,胸骨和垫片板元素也具有其他长度"和宽度".
好吧...我不知道如何编写XML,我尝试如下编写:


What''s more, saddle owns its ID, and sternum and shim-plate also own their ID , on the otherside, sternum and shim-plate elements own other "length" and "width".
Well...I don''t know how to write my XML, I tried to write it like below:

<saddle ID="">
<sternum ID=""><length></lenght></sternum>
<shim-plate ID=""><length></lenght></shim-plate>
</saddle>



是正确的还是会有更好的方法来编写此XML?:confused:
请给我一些建议或帮助!谢谢!!



Is it right or there will be better method to write this XML?:confused:
Please give me some suggestions or help!!Thanks a lot!!

推荐答案

在遵循新的XML标准时,最好避免使用属性,而使用元素.就像下面的XML示例一样:
When following the new XML standards it''s better to avoid attributes and use elements instead. Like the example of your XML below:
<saddle>
    <id></id>
    <sternum>
        <id></id>
        <length></lenght>
    </sternum>
    <shim-plate>
        <id></id>
        <length></lenght>
    </shim-plate>
</saddle>


祝你好运!


Good luck!


这篇关于如何更好地编写我的XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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