处理指令目标匹配“[x X] [mM] [l L]不允许 [英] The processing instruction target matching "[xX][mM][lL]" is not allowed

查看:293
本文介绍了处理指令目标匹配“[x X] [mM] [l L]不允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在CakePHP中输出XML。但是当我把XML放入验证器时,我收到这个错误:

 目标匹配[xX] [mM] [lL]。 

我使用正确的XML布局与<?php echo $ this- > Xml-> header(); ?> 在顶部,然后<?php echo $ content_for_layout; ?>



我的结果是:

 <?xml version =1.0encoding =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 ='大失败的任务'/>
< accepted_task id = '11'type ='您的类型'time_limit ='222'details ='跑步和游泳到日本'/>
< accepted_task id ='7'type ='Man'time_limit ='744'details ='我的脏任务'/>
< / accepted>
< pending>
< pending_task id ='8'type ='Women'time_limit ='5151'details ='女性新任务'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 ='女性新任务'/>
< new_task id ='4'type ='Good'time_limit ='500'details ='Good accepted'/>
< new_task id = '10'type ='Hello'time_limit ='122'details ='这是什么?'/>
< new_task id ='3'type ='Best'time_limit ='880'details ='Stop doing work!'/>
< new_task id = '11'type ='您的类型'time_limit ='222'details ='跑到日本游泳'/>
< new_task id ='6'type ='Great'time_limit ='553'details ='Great accepted task'/>
< new_task id ='7'type ='Man'time_limit ='744'details ='我的脏任务'/>
< new_task id ='9'type ='Excellent'time_limit ='2000'details ='Great failed task'/>
< / new>
< / tasks>
< / response>

这有什么问题吗?

解决方案

marmalad和El Boletaire Underave是对的,你不能从一个空间开始,但这不是完整的故事。根据 XML规范,在XML序言之前,不能有任何内容。



由于您使用的是XML声明,因此您必须以

开头。

 <?xml version =1.0... 

打印字符(如字节顺序标记(BOM))可能会占用文件的前几个字节。 p>

对于更特定于CakePHP的问题,请检查您的文件的开头或末尾是否没有空白行/空格(例如:?> 之前或<?php 之前)。


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.

I am using correct XML layout with <?php echo $this->Xml->header(); ?> at the top then <?php echo $content_for_layout; ?>

My results are:

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

Is there anything wrong with this?

解决方案

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.

Since you are using an XML declaration, you must start your file with

<?xml version="1.0" ...

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.

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).

这篇关于处理指令目标匹配“[x X] [mM] [l L]不允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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