Eu acredito que tenho um erro de sintaxe ou algo assim? Estou confiante de que é algo a ver com xml ou sintaxe. Tudo parece estar em ordem quando olho para o arquivo. Este erro está relacionado ao módulo de notificação do mage, correto? O problema é que não vejo código quebrado, como: <! DOCTYPE HTML PUBLIC "- // IETF // DTD HTML 2.0 // EN">
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : Space required after the Public Identifier in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): ^ in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : SystemLiteral " or ' expected in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): ^ in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : SYSTEM or PUBLIC, the URI is missing in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): ^ in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Opening and ending tag mismatch: hr line 7 and body in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): </body></html> in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): ^ in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Opening and ending tag mismatch: body line 4 and html in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Premature end of data in tag html line 2 in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : Space required after the Public Identifier in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): ^ in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : SystemLiteral " or ' expected in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): ^ in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : SYSTEM or PUBLIC, the URI is missing in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): ^ in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Opening and ending tag mismatch: hr line 7 and body in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): </body></html> in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): ^ in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Opening and ending tag mismatch: body line 4 and html in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:24+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Premature end of data in tag html line 2 in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
2017-11-16T23:12:34+00:00 ERR (3): Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : Space required after the Public Identifier in /var/www/code/www.oop.com/releases/20171116222810/public_html/app/code/local/Magestore/Magenotification/Model/Magenotification.php on line 126
Esta é a linha 126 no Magenotification.php
try {
$xml = new SimpleXMLElement($data);
}
Não me ajuda em nada.
Magenotification.php
class Magestore_Magenotification_Model_Magenotification extends Mage_Core_Model_Abstract
{
const XML_FREQUENCY_PATH = 'magenotification/general/frequency';
const XML_LAST_UPDATE_PATH = 'magenotification/general/last_update';
const XML_MAGESTORE_URL_PATH = 'magenotification/general/magestore_url';
public function _construct()
{
parent::_construct();
$this->_init('magenotification/magenotification');
}
public function checkUpdate()
{
$timestamp = Mage::getModel('core/date')->timestamp(time());
if (($this->getFrequency() + $this->getLastUpdate()) > $timestamp)
{
return $this;
}
$notificationXml = $this->getNotificationData();
$noticeData = array();
if ($notificationXml && $notificationXml->item)
{
foreach ($notificationXml->item as $item) {
$item_data = array(
'severity' => (int)$item->severity,
'date_added' => $this->getDate((string)$item->date_added),
'title' => (string)$item->title,
'description' => (string)$item->description,
'url' => (string)$item->url,
'added_date' => $this->getDate((string)$item->date_added),
'related_extensions' => strtolower($item->related_extensions)
);
if($this->allowGetFeed($item_data)){
$noticeData[] = $item_data;
}
}
if($noticeData)
{
$this->parse(array_reverse($noticeData));
$this->setLastUpdate();
}
}
return $this;
}
public function allowGetFeed($item)
{
if($item['related_extensions'] == null || $item['related_extensions'] == '0'){
return true;
}
$modules = Mage::getConfig()->getNode('modules')->children();
foreach ($modules as $moduleName => $moduleInfo) {
if ($moduleName==='Mage_Adminhtml') {
continue;
}
if ($moduleName==='Magestore_Magenotification') {
continue;
}
if(strpos('a'.$moduleName,'Magestore') == 0){
continue;
}
$extension_code = str_replace('Magestore_','',$moduleName);
$related_extensions = explode(',',$item['related_extensions']);
if(count($related_extensions)){
foreach($related_extensions as $related_extension){
if(strtolower($related_extension) == strtolower($extension_code)){
return true;
}
}
}
}
return false;
}
public function getLastUpdate()
{
$timestring = Mage::getStoreConfig(self::XML_LAST_UPDATE_PATH);
return strtotime($timestring);
}
public function setLastUpdate()
{
$config = Mage::getModel('core/config');
$timestamp = Mage::getModel('core/date')->timestamp(time());
$config ->saveConfig(self::XML_LAST_UPDATE_PATH,$timestamp);
$config->cleanCache();
}
public function getFrequency()
{
return Mage::getStoreConfig(self::XML_FREQUENCY_PATH) * 3600;
}
public function getMagestoreUrl()
{
$lastTimeNotice = strtotime($this->getLastNotice()->getAddedDate());
return Mage::getStoreConfig(self::XML_MAGESTORE_URL_PATH) .'/magenotification/service/getfeed3/lastupdatetime/'. $lastTimeNotice;
}
public function getNotificationData()
{
$curl = new Varien_Http_Adapter_Curl();
$curl->setConfig(array(
'timeout' => 2
));
$curl->write(Zend_Http_Client::GET, $this->getMagestoreUrl(), '1.0');
$data = $curl->read();
if ($data === false) {
return false;
}
$data = preg_split('/^\r?$/m', $data, 2);
$data = trim($data[1]);
$curl->close();
try {
$xml = new SimpleXMLElement($data);
}
catch (Exception $e) {
return false;
}
return $xml;
}
public function getNotificationXml()
{
try {
$data = $this->getNotificationData();
$xml = new SimpleXMLElement($data);
}
catch (Exception $e) {
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?>');
}
return $xml;
}
public function getDate($rssDate)
{
return gmdate('Y-m-d H:i:s', strtotime($rssDate));
}
public function parse($data)
{
if(count($data))
{
try{
foreach($data as $item)
{
if(!$this->is_existedUrl($item['url']) )
{
$this->setData($item)->save();
$this->setId(null);
}
}
} catch(Exception $e) {
Mage::getSingleton('core/session')->addError($e->getMessage());
}
}
}
public function is_existedUrl($url)
{
$collection = $this->getCollection()
->addFieldToFilter('url',(string)$url);
if($collection->getSize())
return true;
return false;
}
public function getLastNotice()
{
$item = $this->getCollection()
->setOrder('added_date','DESC')
->getFirstItem();
return $item;
}
}
Encontrado O documento foi movido para aqui. Servidor Apache / 2.4.10 (Debian) em www.magestore.com A porta 80 String não pôde ser analisada como XML
Encontrado O documento foi movido para aqui. Servidor Apache / 2.4.10 (Debian) em www.magestore.com A porta 80 String não pôde ser analisada como XML
Quando clico aqui, ele exibe alguns xml e a mensagem abaixo, acho que significa que há algo errado com a tag do canal:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<channel/>
Magenotification.php
?Respostas:
Para qualquer um que possa se deparar com isso, uma correção 'rápida' está abaixo:
Atualize esta linha:
Para:
Parece que o Magestore alterou o URL de notificação, portanto a atualização acima deve ser corrigida.
Acredito que a atualização da extensão Magestore_Magenotification para a versão mais recente seja a correção recomendada. No entanto, isso acontecerá se você estiver procurando impedir que o system.log esteja cheio desse erro.
fonte
Obviamente, algo está errado com o arquivo XML que ele está tentando analisar.
Você pode alterar o seguinte código:
para:
E postar os resultados aqui? Ele deve imprimir os dados XML que está tentando analisar e sua mensagem de erro, tenho certeza que mostra algo útil.
fonte
Vi que 3 foram notificados para você.
Isso significa que seu URL retornará uma string HTML em vez de uma string XML. Você pode depurar isso e imprimir a resposta HTML , acho que seu controlador estava errado, não SimpleXMLElement
Atualizada
Deixe-me explicar mais
$ this-> getMagestoreUrl () <== Esta é a sua solicitação de URL (mostre) ..
$ data = $ curl-> read (); este é o texto de resposta do controlador (var_dump ou print_r) desses dados.
fonte