是否有XML文件的编码标准? [英] Are there coding standards for XML files?

查看:69
本文介绍了是否有XML文件的编码标准?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何xml编码标准。

I would like to know if there are any xml coding standards.

<?xml version="1.0"?>
<overlay id="tutorboy-toolbar-Overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    <toolbox id="navigator-toolbox">
        <toolbar id="tutorboy-toolbar-Toolbar" 
                  toolbarname="TutorBoy Toolbar" 
                  accesskey="T" 
                  class="chromeclass-toolbar" 
                  context="toolbar-context-menu" 
                  hidden="false" 
                  persist="hidden">
              <toolbarbutton label="TutorBoy" 
                                id="tutorboy-toolbar-button-home" 
                                accesskey="d" 
                                image="chrome://tutorboy-toolbar/skin/logo.png" 
                                oncommand="loadURL('http://tutorboy.com');" 
                                tooltiptext="Click here to go to the Tutorboy.com homepage." /> 

是否允许这种安排方式?

is this way of arrangement allowed?

推荐答案

W3C定义了XML规范建议:
http://www.w3.org/TR/REC-xml/

The W3C defines an XML specification recommendation: http://www.w3.org/TR/REC-xml/

由于您已将问题缩小为XML格式,因此没有通用答案,说明XML的格式。除了符合要处理的任何DTD或架构之外,标记的特定间距/缩进的重要性还在于将要处理数据的人员。

Since you've narrowed your question to XML formatting, there's no "universal" answer to how your XML should be formatted. Beyond conforming to whatever DTD or schema you happen to be dealing with, the importance of particular spacing/indentation of your tags lies with the people who will be dealing with your data.

如果您要创建XML数据以作为Web服务的一部分或某种形式通过网络发送,那么通常您将需要在传输之前消除任何不必要的空格,以优化数据传输速率。这意味着没有换行符,没有缩进,也没有注释。

If you're creating XML data to be sent across a network as part of a web service or some sort, then generally you're going to want to eliminate any unnecessary whitespace before transfer in order to optimize your data transfer rate. This means no line breaks, no indentation, no comments.

如果您创建的XML文档会被其他人定期阅读/修改,那么显然您会想要考虑一些因素以保持文档的可读性。构成可读性的是由该特定团队或项目中涉及的每个人确定的。

If your creating an XML document that others will be reading/modifying on a regular basis, then obviously you'll want to put some consideration into keeping the document readable. What constitutes "readable" is determined by everyone involved on that particular team or project.

这篇关于是否有XML文件的编码标准?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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