XML parsing Zend output produces XML parsing error

Source: Internet
Author: User
XML parsing error: XML processing directives are not at the beginning of an entity
Location: Http://.../public/xml/get
Line: 2, column: 1:
^
After careful examination, it was found that the first act was empty. Looking for a long time not to find out exactly where the Zend view output a blank line, including initializing a new view, but never find the reason, but the first line of the site home page is not empty.
There are similar examples on the web, but the solution is to pay attention to the control output, but I don't know how the View controls the output. For a long while did not succeed, I almost collapsed, I decided to abandon this method, and first write the XML file to the server and then call. Obviously this will degrade the performance of your site.
After changing the method, I try to find a solution, I find the PHP memory-related information, try to put Ob_end_clean (); Added before the output, as follows:
$xmlfile = $doc->savexml ();
$doc->save ("Data.xml");
Ob_end_clean ();
$this->view->xml = $xmlfile;
Write only one sentence at the top of the view:
XML;?>
And then a tune, Haha, success.

The above describes the XML parsing Zend output to produce XML parsing errors, including the content of XML parsing, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.