Ошибка premature end of data in tag

I took this system ever made but it does not know what it is happening!

line: 197 core.php

foreach ($this->getAll() as $banner) { 

line: 191 core.php

$_xmlBanners = simplexml_load_file(PATH_XML."banners.xml");

my xml:

<?xml version="1.0" encoding="UTF-8"?>
<list>
    <banner id="1">
        <image>http://lineagefree.com/acp/images/l2jbr.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='list_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
    <banner id="2">
        <image>http://lineagefree.com/acp/images/top100mmorpg.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
    <banner id="3">
        <image>http://lineagefree.com/acp/images/gamesitestop100.jpg</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        <banner id="4">
        <image>http://lineagefree.com/acp/images/arenatop100.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        <banner id="5">
        <image>http://lineagefree.com/acp/images/mmorpglist.jpg</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        <banner id="6">
        <image>http://lineagefree.com/acp/images/top200.gif</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
</list>

My errors retorn :

[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: /home/lineage/public_html/acp/xml/banners.xml:48: parser error : Opening and ending tag mismatch: banner line 33 and list in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: &lt;/list&gt; in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]:        ^ in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: /home/lineage/public_html/acp/xml/banners.xml:48: parser error : Premature end of data in tag banner line 26 in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: &lt;/list&gt; in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]:        ^ in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: /home/lineage/public_html/acp/xml/banners.xml:48: parser error : Premature end of data in tag banner line 19 in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: &lt;/list&gt; in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]:        ^ in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: /home/lineage/public_html/acp/xml/banners.xml:48: parser error : Premature end of data in tag list line 2 in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: &lt;/list&gt; in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]:        ^ in /home/lineage/public_html/acp/core.php on line 191
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Notice:  Trying to get property of non-object in /home/lineage/public_html/acp/core.php on line 206
[23-Aug-2013 15:35:20 America/Sao_Paulo] PHP Warning:  Invalid argument supplied for foreach() in /home/lineage/public_html/acp/core.php on line 197

I am with this problem. heard of characters encoded.
something.
but how do I fix?
follows all data. if you need any more please ask me. I’m desperate. Sorry my english. was done with google!
thank you

asked Aug 23, 2013 at 18:59

user2688200's user avatar

You are missing a bunch of end tags. Load the file in a browser, and it will tell you the line number.

Below you will see the fixed xml:

<?xml version="1.0" encoding="UTF-8"?>
<list>
    <banner id="1">
        <image>http://lineagefree.com/acp/images/l2jbr.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='list_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
    <banner id="2">
        <image>http://lineagefree.com/acp/images/top100mmorpg.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
    <banner id="3">
        <image>http://lineagefree.com/acp/images/gamesitestop100.jpg</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        </banner>
        <banner id="4">
        <image>http://lineagefree.com/acp/images/arenatop100.png</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        </banner>
        <banner id="5">
        <image>http://lineagefree.com/acp/images/mmorpglist.jpg</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
        </banner>
        <banner id="6">
        <image>http://lineagefree.com/acp/images/top200.gif</image>
        <link>http://l2j.lt/topai/balsuoti-7907.php</link>
        <votes>
            <link>http://l2j.lt/topai/mokamas-7907.php</link>
            <regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
        </votes>
    </banner>
  </list>

Perry's user avatar

Perry

10.9k2 gold badges27 silver badges37 bronze badges

answered Aug 23, 2013 at 19:06

OldProgrammer's user avatar

OldProgrammerOldProgrammer

11.9k3 gold badges24 silver badges45 bronze badges

2

your <banner id="3"> doesn’t have a closing tag. neither do the <banner id="4"> and <banner id="5"> tags.

If you add closing </banner> tags to those, your xml will be valid

answered Aug 23, 2013 at 19:04

Sam I am says Reinstate Monica's user avatar

banner elements having id 3, 4, and 5 are not closed. Please check your XML. You should close all tags.

answered Aug 23, 2013 at 19:05

CuriousMind's user avatar

CuriousMindCuriousMind

3,1433 gold badges28 silver badges52 bronze badges

Возникла проблема при выгрузке на Маркет. При очередном экспорте файла выдал такую ошибку —

2016-10-17 05:53:21:
Error #73[3] at [24303:25]: expected '>'

        Error #77[3] at [24303:25]: Premature end of data in tag offer line 24295

        Error #77[3] at [24303:25]: Premature end of data in tag offers line 728

        Error #77[3] at [24303:25]: Premature end of data in tag shop line 4

        Error #77[3] at [24303:25]: Premature end of data in tag yml_catalog line 3

Error #522[2] at [0:0]: no DTD found!

Попробовал экспортировать еще раз, ошибки не выдало, но сам файл все равно выгружается неправильно — в конце файла вместо </yml_catalog> — </yml_catalo

При выгрузке в логах никаких ошибок нет. Через некоторое время в error.log —

2016-10-18 02:01:59:
Uncaught exception waException:
Unknown auth provider (0)
#0 /home/admin/web/cvtplus.ru/public_html/wa-system/controller/waOAuthController.class.php(33): waOAuthController->getAuthAdapter('')
#1 /home/admin/web/cvtplus.ru/public_html/wa-system/controller/waController.class.php(21): waOAuthController->execute()
#2 /home/admin/web/cvtplus.ru/public_html/wa-system/controller/waViewController.class.php(46): waController->run(NULL)
#3 /home/admin/web/cvtplus.ru/public_html/wa-system/controller/waFrontController.class.php(139): waViewController->run()
#4 /home/admin/web/cvtplus.ru/public_html/wa-system/waSystem.class.php(517): waFrontController->execute(NULL, 'OAuth')
#5 /home/admin/web/cvtplus.ru/public_html/index.php(7): waSystem->dispatch()

Поддержка ничем помочь не может. уже надоело выгружать вручную и поправлять конец файла. Может кто то сталкивался с подобным?

When I use DOMDocument in PHP file, I get the following errors:

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag nodes line 7 in Entity, line: 7 in D:wampwwwdom1.php on line 77

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag node line 6 in Entity, line: 7 in D:wampwwwdom1.php on line 77

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag field line 5 in Entity, line: 7 in D:wampwwwdom1.php on line 77

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag field line 5 in Entity, line: 7 in D:wampwwwdom1.php on line 77

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag field line 4 in Entity, line: 7 in D:wampwwwdom1.php on line 77

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag field line 4 in Entity, line: 7 in D:wampwwwdom1.php on line 77

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag node line 3 in Entity, line: 7 in D:wampwwwdom1.php on line 77

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag node line 2 in Entity, line: 7 in D:wampwwwdom1.php on line 77

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag node line 2 in Entity, line: 7 in D:wampwwwdom1.php on line 77

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag nodes line 1 in Entity, line: 7 in D:wampwwwdom1.php on line 77
array(0) { }

The php code is as follows:

<?php
class MyDOMDocument extends DOMDocument
{
    public function toArray(DOMNode $oDomNode = null)
    {
        // return empty array if dom is blank
        if (is_null($oDomNode) && !$this->hasChildNodes()) {
            return array();
        }
        $oDomNode = (is_null($oDomNode)) ? $this->documentElement : $oDomNode;
        if (!$oDomNode->hasChildNodes()) {
            $mResult = $oDomNode->nodeValue;
        } else {
            $mResult = array();
            foreach ($oDomNode->childNodes as $oChildNode) {
                // how many of these child nodes do we have?
                // this will give us a clue as to what the result structure should be
                $oChildNodeList = $oDomNode->getElementsByTagName($oChildNode->nodeName); 
                $iChildCount = 0;
                // there are x number of childs in this node that have the same tag name
                // however, we are only interested in the # of siblings with the same tag name
                foreach ($oChildNodeList as $oNode) {
                    if ($oNode->parentNode->isSameNode($oChildNode->parentNode)) {
                        $iChildCount++;
                    }
                }
                $mValue = $this->toArray($oChildNode);
                $sKey   = ($oChildNode->nodeName{0} == '#') ? 0 : $oChildNode->nodeName;
                $mValue = is_array($mValue) ? $mValue[$oChildNode->nodeName] : $mValue;
                // how many of thse child nodes do we have?
                if ($iChildCount > 1) {  // more than 1 child - make numeric array
                    $mResult[$sKey][] = $mValue;
                } else {
                    $mResult[$sKey] = $mValue;
                }
            }
            // if the child is <foo>bar</foo>, the result will be array(bar)
            // make the result just 'bar'
            if (count($mResult) == 1 && isset($mResult[0]) && !is_array($mResult[0])) {
                $mResult = $mResult[0];
            }
        }
        // get our attributes if we have any
        $arAttributes = array();
        if ($oDomNode->hasAttributes()) {
            foreach ($oDomNode->attributes as $sAttrName=>$oAttrNode) {
                // retain namespace prefixes
                $arAttributes["@{$oAttrNode->nodeName}"] = $oAttrNode->nodeValue;
            }
        }
        // check for namespace attribute - Namespaces will not show up in the attributes list
        if ($oDomNode instanceof DOMElement && $oDomNode->getAttribute('xmlns')) {
            $arAttributes["@xmlns"] = $oDomNode->getAttribute('xmlns');
        }
        if (count($arAttributes)) {
            if (!is_array($mResult)) {
                $mResult = (trim($mResult)) ? array($mResult) : array();
            }
            $mResult = array_merge($mResult, $arAttributes);
        }
        $arResult = array($oDomNode->nodeName=>$mResult);
        return $arResult;
    }
}

$sXml = <<<XML
<nodes>
    <node>text<node>
    <node>
        <field>hello<field>
        <field>world<field>
    <node>
<nodes>
XML;

$dom = new MyDOMDocument;
$dom -> loadXml($sXml);
var_dump($dom->toArray());
?>

source location:
http://bd.php.net/manual/en/class.domdocument.php

Русскоязычный форум CS-Cart

Загрузка…

Добрый день. Ковыряю Sopa сервис (делаю обмен данными, т.е. пытаюсь реализовать и сервер и клиент). Сделал wsdl файл, сервер и клиент.
При запуске клиента выдает следующую ошибку:
SOAP-ERROR: Parsing WSDL: Couldn’t load from ‘myservice.ru/soap/test.wsdl’ : Premature end of data in tag definitions line 2

Хочу обратить внимание, что при переходе по урл wsdl файла он скачивается, а не открывается в браузере. Так должно быть? Пробовал открыть wsdl файлы других сервисов — они открывались в браузере.


  • Вопрос задан

    более трёх лет назад

  • 896 просмотров

complexType не имеет закрывающего тега

Картинка

5ea2eb7b950e3226189026.png

Пригласить эксперта

SOAP-ERROR: Parsing WSDL: Unexpected WSDL element
С этой ошибкой разобрался. В wsdl element не был заключен в complexType.
Все в принципе работает, но только если в клиенте при вызове функции передавать ей явно параметр. Не пойму как и где вся эта система должна брать данные из xml файла-запроса.

Если кто-то сможет разжевать, буду признателен))


  • Показать ещё
    Загружается…

05 июн. 2023, в 22:21

1500 руб./за проект

05 июн. 2023, в 22:02

500 руб./за проект

05 июн. 2023, в 21:36

100000 руб./за проект

Минуточку внимания

Понравилась статья? Поделить с друзьями:
  • Ошибка precomp inside
  • Ошибка pre на котле будерус
  • Ошибка pre safe w221
  • Ошибка pre safe w212
  • Ошибка pre safe mercedes