Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Błędy przy wczytywaniu pliku xml.
Forum PHP.pl > Forum > PHP
gramy52
Witam.

Wczytywanie pliku xml - operacja ta zawsze kończyła się pomyślnie. Ostatnio jednak, dostaję niespodziewany komunikat (z CMS):

Kod
Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:1: parser error : Space required after the Public Identifier in aktualizacja.php  on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:1: parser error : SystemLiteral " or ' expected in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:1: parser error : SYSTEM or PUBLIC, the URI is missing in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:11: parser error : Opening and ending tag mismatch: hr line 9 and body in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: </body></html> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:11: parser error : Opening and ending tag mismatch: body line 4 and html in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: </body></html> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:12: parser error : XML declaration allowed only at the start of the document in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: <?xml version="1.0" encoding="UTF-8"?> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:13: parser error : Premature end of data in tag html line 2 in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169


Fragment kodu z aktualizacja.php
  1. $object = simplexml_load_file('cennik/kategorie.xml');


i z pliku xml (pierwsze linie dokumentu).
  1. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  2. <html><head>
  3. <title>xxx</title>
  4. </head><body>
  5. <h1>xxx</h1>
  6. xxx<br />/xxx<br />
  7. xxx
  8. <hr>
  9. <address>xxx</address>
  10. </body></html>
  11. <?xml version="1.0" encoding="UTF-8"?>
  12. >>dalej to już poufne dane<<


Nowicjuszem jestem w tych sprawach - próbowałem sam rozwiązać problem (sugerując się 'Warning' od CMS) jednak bez skutecznie. Zwracam się do was z prośbą o pomoc.

Pozdrawiam.
Pilsener
Spróbuj podmienić plik XML na jakiś skrajnie prosty, jeśli wtedy simple-xml.. zadziała to znaczy, że masz błędy w pliku xml.
TomASS
obawiam się, że może rozchodzić się o kod - spróbuj go usunąć:


  1. <html><head>
  2. <title>xxx</title>
  3. </head><body>
  4. <h1>xxx</h1>
  5. xxx<br />/xxx<br />
  6. xxx
  7. <hr>
  8. <address>xxx</address>
  9. </body></html>

gramy52
Nie działa - sposób zaimplementowania prostego pliku xml, jak i usunięcia część kodu w pliku XML. Dostaje te same informacje. Ktoś pomoże? Sam próbuje jednak bezskutecznie. Proszę...
TomASS
A taki plik wczyta Ci poprawnie?
  1. <?xml version="1.0" ?>
  2. <artist>
  3. <name>Artysta 1</name>
  4. <location>Lokalizacja 1</location>
  5. </artist>
  6. <artist>
  7. <name>Artysta 2</name>
  8. <location>Lokalizacja 2</location>
  9. </artist>
gramy52
Dostaje te same komunikaty.... a dokładnie te:

Kod
Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:1: parser error : Space required after the Public Identifier in aktualizacja.php  on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:1: parser error : SystemLiteral " or ' expected in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:1: parser error : SYSTEM or PUBLIC, the URI is missing in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:11: parser error : Opening and ending tag mismatch: hr line 9 and body in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: </body></html> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:11: parser error : Opening and ending tag mismatch: body line 4 and html in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: </body></html> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:12: parser error : XML declaration allowed only at the start of the document in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: <?xml version="1.0" encoding="UTF-8"?> in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: cennik/kategorie.xml:13: parser error : Premature end of data in tag html line 2 in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: in aktualizacja.php on line 169

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in aktualizacja.php on line 169
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.