web-dev-qa-db-fra.com

Erreur dans le fichier xml: fin prématurée des données dans la balise

J'ai pris ce système jamais fabriqué mais il ne sait pas ce qu'il se passe!

ligne: 197 core.php

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

ligne: 191 core.php

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

mon 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>

Mes erreurs renaissent:

[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

Je suis avec ce problème. entendu parler de caractères encodés ... quelque chose ... mais comment puis-je résoudre ce problème? si vous avez besoin de plus s'il vous plaît demandez-moi. Je suis désespéré. Désolé pour mon anglais. a été fait avec google! merci

8
user2688200

Il vous manque un tas de balises de fin. Chargez le fichier dans un navigateur, qui vous indiquera le numéro de la ligne.

Ci-dessous, vous verrez le xml corrigé:

<?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>
10
OldProgrammer

votre <banner id="3"> n'a pas de balise de fermeture. ni les balises <banner id="4"> et <banner id="5">.

Si vous ajoutez des balises </banner> fermantes à celles-ci, votre code xml sera valide.

0
Sam I am

les éléments de bannière ayant les identificateurs 3, 4 et 5 ne sont pas fermés. Veuillez vérifier votre XML. Vous devriez fermer toutes les balises.

0
CuriousMind