php - 什么是 <?xml version ="1.0"?>?

标签 php xml xml-parsing

有什么区别

<?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/

相关文章:

php - MySQL 在多个列中搜索匹配项

php - 删除链接不删除mysql数据库中的任何记录

php - str_replace 没有按预期工作

javascript - 在不使用服务器的情况下在 HTML 页面中使用 XML

python - 使用 Scrapy 抓取 arXiv xml 数据

ruby-on-rails - 使用 Ruby on Rails 4.0 解析本地 XML 文件

php - Laravel 基本身份验证 - 获取用户详细信息

java - Jaxb, Class 有两个同名属性

java - 用于 html 到 pdf 的 Xmlparser

java - Windows 和 Linux 下不同的 XML 相关行为