Home > Backend Development > PHP Tutorial > Zend output produces XML parsing error_PHP tutorial

Zend output produces XML parsing error_PHP tutorial

WBOY
Release: 2016-07-21 15:47:13
Original
1263 people have browsed it

XML parsing error: xml processing directive is not at the beginning of the entity
Location: http://.../public/xml/get
Row: 2, Column: 1:
^
After careful inspection, I found that the first line is empty. After searching for a long time, I couldn't find where zend's view outputs a blank line, including initializing a new View, but I still haven't found the reason, but the first line of the website homepage is not empty.
There are similar examples on the Internet, but their solution is to pay attention to controlling the output, but I don’t know how View controls the output. After working for a long time without success, I almost collapsed. I decided to give up this method and write the xml file to the server first and then call it. Obviously this will reduce the performance of the website.
After changing the method, I tried to find a solution. I looked for information related to PHP memory and tried to add ob_end_clean(); before the output, as follows:
$xmlfile = $doc ->saveXML();
//$doc->save("data.xml");
ob_end_clean();
$this->view->xml = $xmlfile;
Just write one sentence at the top of the view:
xml; ?>
Then adjust it again, haha, it’s successful.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319953.htmlTechArticleXML parsing error: xml processing instruction is not at the beginning of the entity: http://.../public/ xml/get row: 2, column: 1:?xml version="1.0"? ^ After careful inspection, it was found that the first line was empty. Found it...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template