2011-10-29 21 views
38

की अनुमति नहीं है मैं केकेपीएचपी में एक्सएमएल आउटपुट कर रहा हूं। जब मैं अपने एक्सएमएल एक सत्यापनकर्ता में डाल दिया लेकिन मैं इस त्रुटि हो रही है:प्रसंस्करण निर्देश लक्ष्य मिलान "[xX] [एमएम] [एलएल]"

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

<?php echo $this->Xml->header(); ?> साथ शीर्ष पर तो मैं सही एक्सएमएल लेआउट का उपयोग कर रहा <?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

क्या आपने जांच की है कि एक्सएमएल भिखारी पर किसी रिक्त स्थान के बिना उत्पन्न होता है? – elboletaire

उत्तर

64

मर्मलाद और एल बोलेटियर अंडरवे सही हैं कि आप किसी स्थान से शुरू नहीं कर सकते हैं, लेकिन यह पूरी कहानी नहीं है। the XML spec के अनुसार, आपके पास XML प्रोलॉग से पहले कुछ भी नहीं हो सकता है।

आप एक XML घोषणा प्रयोग कर रहे हैं के बाद से, आप

<?xml version="1.0" ... 

कुछ मामलों में साथ अपनी फ़ाइल शुरू करनी चाहिए, the byte order mark (BOM) जैसी गैर-मुद्रण वर्ण एक फ़ाइल के पहले कुछ बाइट्स लेने से परेशानी पैदा कर सकता है।

केकपीएचपी के लिए अधिक विशिष्ट समस्या के लिए, यह देखने के लिए जांचें कि आपके पास अपनी फ़ाइलों के प्रारंभ या अंत में भटक खाली रेखाएं/सफेद जगह नहीं है (यानी आपके ?> या <?php से पहले)।

13

El Boletaire Underave said के रूप में, जांचें कि क्या XML भिखारी पर किसी भी रिक्त स्थान के बिना उत्पन्न होता है या नहीं। यह मेरी एक्सएमएल के साथ मेरी मदद करता है।

1

अपनी एक्सएमएल फ़ाइल की जांच करें, यह एक रिक्त स्थान से शुरू हो सकता है। यदि आपकी एक्सएमएल फ़ाइल रिक्त स्थान से शुरू होती है तो इस प्रकार की अपवाद फेंक दी जाएगी।

0

<?xml ?> टैग से पहले आपके पास कोई स्थान नहीं होना चाहिए। यह टैग पहली पंक्ति पर होना चाहिए। यह मेरे लिए काम किया

संबंधित मुद्दे