什么是<?xml version=“1.0"?>? [英] What is <?xml version="1.0"?>?

查看:42
本文介绍了什么是<?xml version=“1.0"?>?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?xml version="1.0"?>

<xml version="1.0">

为什么在 XML 标签中看起来像 PHP 的简写?我确定这就是它,但为什么会在那里?

Why does it look like shorthand PHP in the XML tag? I'm sure that's what it is but why is it there?

我有一个抛出错误的 XML 文件,但我找不到错误,现在我假设它是 XML 标记中的 ??

I have an XML file that is throwing an error, but I couldn't find the error and now I'm assuming it's the ? in the XML tag?

推荐答案

XML 声明

XML 声明.它是 XML 版本、字符编码和独立文档声明的可选指示.它可以仅显示为 XML 文件的最顶部, 如有,不得重复.

XML Declaration

<?xml version="1.0"?> is an XML declaration. It is an optional indication of the version of XML, the character encoding, and the standalone document declaration. It can only appear as the very top of an XML file, if anywhere, and may not be repeated.

是 XML 元素的开放标记(需要结束标记).虽然它是格式良好的(如果正确关闭),但不要使用它——它看起来太像一个拙劣的 XML 声明.此外,W3C XML 建议指出:

<xml version="1.0"> is an open tag (that will require a closing tag) to an XML element. While it would be well-formed (if properly closed), do not use this -- it looks too much like an bungled XML declaration. Moreover, the W3C XML Recommendation states:

名称以字符串 "xml" 开头,或以任何字符串开头将匹配 (('X'|'x') ('M'|'m') ('L'|'l')),保留用于本规范的此版本或未来版本中的标准化.

Names beginning with the string "xml", or with any string which would match (('X'|'x') ('M'|'m') ('L'|'l')), are reserved for standardization in this or future versions of this specification.

这篇关于什么是&lt;?xml version=“1.0"?&gt;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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