The processing instruction target matching quot;[xX][mM][lL]quot; is not allowed(处理指令目标匹配“[xX][mM][lL]不被允许)
问题描述
我在 CakePHP 中输出 XML.但是当我将 XML 放入验证器时出现此错误:
I'm outputting XML in CakePHP. But I'm getting this error when I put my XML into a validator:
The processing instruction target matching "[xX][mM][lL]" is not allowed.
我在 <?php echo $this->Xml->header(); 中使用了正确的 XML 布局;?> 在顶部然后
I am using correct XML layout with <?php echo $this->Xml->header(); ?> at the top then <?php echo $content_for_layout; ?>
我的结果是:
<?xml version="1.0" encoding="UTF-8" ?><response type='' outcome='true' message='Login successful!'>
<user id='1234' total_number_of_completed_tasks='0' total_number_of_declined_tasks='0' total_number_of_passed_tasks='1' total_number_of_failed_tasks='1' reputation_points='99' deviant_points='0' />
<tasks>
<accepted>
<accepted_task id='4' type='Good' time_limit='500' details='Good accepted' />
<accepted_task id='5' type='OK' time_limit='660' details='Ok New task' />
<accepted_task id='9' type='Excellent' time_limit='2000' details='Great failed task' />
<accepted_task id='11' type='Your type' time_limit='222' details='Running and swimming all the way to Japan' />
<accepted_task id='7' type='Man' time_limit='744' details='My dirty task' />
</accepted>
<pending>
<pending_task id='8' type='Women' time_limit='5151' details='Women new task' sender_id='11111' sent_date='2031-01-01 00:00:00' sender_name='Jae Choi' />
</pending>
<completed>
</completed>
<new>
<new_task id='5' type='OK' time_limit='660' details='Ok New task' />
<new_task id='8' type='Women' time_limit='5151' details='Women new task' />
<new_task id='4' type='Good' time_limit='500' details='Good accepted' />
<new_task id='10' type='Hello' time_limit='122' details='What is this?' />
<new_task id='3' type='Best' time_limit='880' details='Stop doing work!' />
<new_task id='11' type='Your type' time_limit='222' details='Running and swimming all the way to Japan' />
<new_task id='6' type='Great' time_limit='553' details='Great accepted task' />
<new_task id='7' type='Man' time_limit='744' details='My dirty task' />
<new_task id='9' type='Excellent' time_limit='2000' details='Great failed task' />
</new>
</tasks>
</response>
这有什么问题吗?
推荐答案
marmalad 和 El Boletaire Underave 是对的,你不能从一个空格开始,但这不是全部.根据 XML 规范,您根本无法拥有任何东西在 XML 序言之前.
marmalad and El Boletaire Underave are right that you can't start with a space, but that's not the full story. According to the XML spec, you can't have anything at all before the XML prolog.
由于您使用的是 XML 声明,因此您的文件必须以
Since you are using an XML declaration, you must start your file with
<?xml version="1.0" ...
在某些情况下,诸如字节顺序标记 (BOM) 之类的非打印字符可能会导致麻烦占用文件的前几个字节.
In some cases, non-printing characters like the byte order mark (BOM) can cause trouble by taking up the first few bytes of a file.
对于更具体的 CakePHP 问题,请检查文件的开头或结尾处(即在您的 ?> 之后或您之前).
For a problem more specific to CakePHP, check to see that you don't have stray blank lines/whitespace at the start or end of your files (i.e. after your ?> or before your <?php).
这篇关于处理指令目标匹配“[xX][mM][lL]"不被允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:处理指令目标匹配“[xX][mM][lL]"不被允许
基础教程推荐
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
