警告:simplexml_load_string(Magento错误)

时间:2016-07-13 16:35:05

标签: php magento simplexml

我在晚上在我的网站上面对以下错误(请帮助): -

2016-07-13T16:10:43+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 143: parser error : Premature end of data in tag allowed_methods line 143  in /home/digi/public_html/lib/Varien/Simplexml/Config.php on line 510
2016-07-13T16:10:43+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 143: parser error : Premature end of data in tag fedex line 134  in /home/digi/public_html/lib/Varien/Simplexml/Config.php on line 510
2016-07-13T16:10:43+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 143: parser error : Premature end of data in tag carriers line 106  in /home/digi/public_html/lib/Varien/Simplexml/Config.php on line 510
2016-07-13T16:10:43+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 143: parser error : Premature end of data in tag default line 98  in /home/digi/public_html/lib/Varien/Simplexml/Config.php on line 510
2016-07-13T16:10:43+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 143: parser error : Premature end of data in tag config line 28  in /home/digi/public_html/lib/Varien/Simplexml/Config.php on line 510
2016-07-13T16:10:45+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 143: parser error : Premature end of data in tag allowed_methods line 143  in /home/digi/public_html/lib/Varien/Simplexml/Config.php on line 510
2016-07-13T16:10:45+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 143: parser error : Premature end of data in tag fedex line 134  in /home/digi/public_html/lib/Varien/Simplexml/Config.php on line 510
2016-07-13T16:10:45+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 143: parser error : Premature end of data in tag carriers line 106  in /home/digi/public_html/lib/Varien/Simplexml/Config.php on line 510
2016-07-13T16:10:45+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 143: parser error : Premature end of data in tag default line 98  in /home/digi/public_html/lib/Varien/Simplexml/Config.php on line 510
2016-07-13T16:10:45+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 143: parser error : Premature end of data in tag config line 28  in /home/digi/public_html/lib/Varien/Simplexml/Config.php on line 510

我的Config文件在下面分享: -

    }
    if (is_null($newChecksum)) {
        return true;
    }
    $cachedChecksum = $this->getCache()->load($this->getCacheChecksumId());
    return $newChecksum===false && $cachedChecksum===false || $newChecksum===$cachedChecksum;
}

/**
 * Enter description here...
 *
 * @return boolean
 */
public function loadCache()
{
    if (!$this->validateCacheChecksum()) {
        return false;
    }

    $xmlString = $this->_loadCache($this->getCacheId());
    $xml = simplexml_load_string($xmlString, $this->_elementClass);
    if ($xml) {
        $this->_xml = $xml;
        $this->setCacheSaved(true);
        return true;
    }

    return false;
}

/**
 * Enter description here...
 *
 * @param array $tags
 * @return Varien_Simplexml_Config
 */
public function saveCache($tags=null)
{
    if ($this->getCacheSaved()) {
        return $this;
    }
    if (false===$this->getCacheChecksum()) {
        return $this;
    }

    if (is_null($tags)) {
        $tags = $this->_cacheTags;
    }

    if (!is_null($this->getCacheChecksum())) {
        $this->_saveCache($this->getCacheChecksum(), $this->getCacheChecksumId(), $tags, $this->getCacheLifetime());
    }

    $xmlString = $this->getXmlString();
    $this->_saveCache($xmlString, $this->getCacheId(), $tags, $this->getCacheLifetime());

    $this->setCacheSaved(true);

    return $this;
}

/**
 * Return Xml of node as string
 *
 * @return string
 */
public function getXmlString()
{
    return $this->getNode()->asNiceXml('', false);
}

/**
 * Enter description here...
 *
 * @return Varien_Simplexml_Config
 */
public function removeCache()
{
    $this->_removeCache($this->getCacheId());
    $this->_removeCache($this->getCacheChecksumId());
    return $this;
}

/**
 * Enter description here...
 *
 * @param string $id
 * @return boolean
 */
protected function _loadCache($id)
{
    return $this->getCache()->load($id);
}

/**
 * Enter description here...
 *
 * @param string $data
 * @param string $id
 * @param array $tags
 * @param int|boolean $lifetime
 * @return boolean
 */
protected function _saveCache($data, $id, $tags=array(), $lifetime=false)
{
    return $this->getCache()->save($data, $id, $tags, $lifetime);
}

/**
 * Enter description here...
 *
 * @todo check this, as there are no caches that implement remove() method
 * @param string $id
 * @return unknown
 */
protected function _removeCache($id)
{
    return $this->getCache()->remove($id);
}

/**
 * Imports XML file
 *
 * @param string $filePath
 * @return boolean
 */
public function loadFile($filePath)
{
    if (!is_readable($filePath)) {
        //throw new Exception('Can not read xml file '.$filePath);
        return false;
    }

    $fileData = file_get_contents($filePath);
    $fileData = $this->processFileData($fileData);
    return $this->loadString($fileData, $this->_elementClass);
}

/**
 * Imports XML string
 *
 * @param  string $string
 * @return boolean
 */
public function loadString($string)
{
    if (is_string($string)) {
        $xml = simplexml_load_string($string, $this->_elementClass);

        if ($xml instanceof Varien_Simplexml_Element) {
            $this->_xml = $xml;
            return true;
        }
    } else {
        Mage::logException(new Exception('"$string" parameter for simplexml_load_string is not a string'));
    }
    return false;
}

/**
 * Imports DOM node
 *
 * @param DOMNode $dom
 * @return Varien_Simplexml_Element
 */
public function loadDom($dom)
{
    $xml = simplexml_import_dom($dom, $this->_elementClass);

    if ($xml) {
        $this->_xml = $xml;
        return true;
    }

    return false;
}

/**
 * Create node by $path and set its value.
 *
 * @param string $path separated by slashes
 * @param string $value
 * @param boolean $overwrite
 * @return Varien_Simplexml_Config
 */
public function setNode($path, $value, $overwrite=true)
{
    $xml = $this->_xml->setNode($path, $value, $overwrite);
    return $this;
}

/**
 * Process configuration xml
 *
 * @return Varien_Simplexml_Config
 */
public function applyExtends()
{
    $targets = $this->getXpath($this->_xpathExtends);
    if (!$targets) {
        return $this;
    }

    foreach ($targets as $target) {
        $sources = $this->getXpath((string)$target['extends']);
        if ($sources) {
            foreach ($sources as $source) {
                $target->extend($source);
            }
        } else {
            #echo "Not found extend: ".(string)$target['extends'];
        }
        #unset($target['extends']);
    }
    return $this;
}

/**
 * Stub method for processing file data right after loading the file text
 *
 * @param string $text
 * @return string
 */
public function processFileData($text)
{
    return $text;
}

/**
 * Enter description here...
 *
 * @param Varien_Simplexml_Config $config
 * @param boolean $overwrite
 * @return Varien_Simplexml_Config
 */
public function extend(Varien_Simplexml_Config $config, $overwrite=true)
{
    $this->getNode()->extend($config->getNode(), $overwrite);
    return $this;
}

}

0 个答案:

没有答案