^ 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"/> ^ 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">

Home >Backend Development >PHP Tutorial >XML parsing Zend output produces XML parsing errors

XML parsing Zend output produces XML parsing errors

WBOY
WBOYOriginal
2016-07-29 08:39:291083browse

XML parsing error: xml processing instruction 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 on it 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:
< ;?=$this->xml; ?>
Then adjust it again, haha, it was successful.

The above introduces the XML parsing errors caused by Zend output, including the content of XML parsing. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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