有什么区别
<?xml version="1.0"?>
和
<xml version="1.0">
为什么在XML标签里看起来像速记PHP?我确定它就是这样,但为什么它在那里?
我有一个 XML 文件抛出错误,但我找不到错误,现在我假设它是 XML 标记中的 ?
?
最佳答案
XML声明
<?xml version="1.0"?>
是一个 XML declaration .它是 XML 版本、字符编码和独立文档声明的可选指示。它可以only appear as the very top of an XML file, if anywhere, and may not be repeated .
<xml version="1.0">
是 XML 元素的开始标记(需要结束标记)。虽然它格式正确(如果正确关闭),但不要使用它——它看起来太像一个乱七八糟的 XML 声明。此外,W3C XML 推荐标准 states :
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.
关于php - 什么是 <?xml version ="1.0"?>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45380229/