2011-10-29 2 views
38

CakePHP에서 XML을 출력하고 있습니다. 내가 발리에 내 XML을 넣을 때 나는이 오류를 받고 있어요 : 다음 상단에 <?php echo $this->Xml->header(); ?>와 내가 올바른 XML 레이아웃을 사용하고"[xX] [mM] [1L]"과 일치하는 처리 명령 대상이 허용되지 않습니다.

The processing instruction target matching "[xX][mM][lL]" is not allowed. 

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

이것에 문제가 있습니까?

+9

빈둥 빈둥없이 XML이 생성되는지 확인 했습니까? – elboletaire

답변

64

마멀레이드와 엘 볼레타르 언더는 우주에서 시작할 수 없다는 것이 옳지 만 그게 전부는 아닙니다. the XML spec에 따르면 XML 프롤로그 전에는 아무 것도 가질 수 없습니다. 당신은 XML 선언을 사용하고 있기 때문에

, 당신은 어떤 경우

<?xml version="1.0" ... 

사용하여 파일을 시작해야 the byte order mark (BOM) 같은 인쇄되지 않는 문자는 파일의 처음 몇 바이트를 취함으로써 문제가 발생할 수 있습니다.

CakePHP에 더 관련된 문제인 경우 파일 시작 또는 끝에 빈 줄/공백이 있는지 확인하십시오 (예 : ?> 또는 <?php 앞에 오는 경우).

1

XML 파일을 확인하십시오. 공백으로 시작해야합니다. XML 파일이 공백으로 시작하면이 유형의 Exception이 발생합니다.

0

전에 <?xml ?> 태그 u에 공백이 없어야합니다. 이 태그는 첫 줄에 있어야합니다. 이것이 나를 위해 일했던

관련 문제