XML parsing error generated by Zend output _ PHP Tutorial

Source: Internet
Author: User
Tags processing instruction
Zend output produces XML parsing errors. XML parsing error: the xml processing instruction is not in the starting part of the object:... publicxmlget row: 2, column: 1 :? Xmlversion1.0? ^ After careful check, it is found that the first behavior is empty. XML parsing error found: the xml processing instruction is not at the beginning of the object.
Location: http: //.../public/xml/get
Row: 2, column: 1:
^
After careful check, it is found that the first behavior is empty. After searching for a long time, I did not find out where the zend view outputs a blank line, including initializing a new View. but I still did not find the reason, but the first line of the website homepage is not empty.
There are similar examples on the Internet, but the solution is to control the output, but I don't know how to control the output of the View. After half a day, I was not successful. I almost collapsed. I decided to give up this method, but first write the xml file to the server and then call it. Obviously, this will reduce the website's performance.
After changing the method, I tried to find a solution. I looked for PHP memory-related information and tried to add ob_end_clean (); to 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;?>
Then try again. haha, it's successful.

Region location: http: //.../public/xml/get row: 2, column: 1 :? Xml version = "1.0 "? ^ After careful check, it is found that the first behavior is empty. Found...

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.