Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [XML] - Odczyt plików xml
topor1988
post
Post #1





Grupa: Zarejestrowani
Postów: 59
Pomógł: 0
Dołączył: 2.03.2008

Ostrzeżenie: (10%)
X----


Witam.
Potrzebuje odczytac dane z pliku *xml. Dokładnie pola name i file. przeglądałem już manuala, testowałem ale za każdym razem wychodzą jakies błędy. Czy ktoś może pomoc jak odczytac te dany?



  1. <?xml version="1.0"?>
  2. <monsters>
  3.    <monster name="Amazon" file="Amazon.xml" />
  4.    <monster name="Ancient Scarab" file="Ancient scarab.xml" />
  5.    <monster name="Assassin" file="Assassin.xml" />
  6.    .
  7.    .
  8.    .
  9. </monsters>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
dawik
post
Post #2





Grupa: Zarejestrowani
Postów: 43
Pomógł: 1
Dołączył: 25.02.2008

Ostrzeżenie: (20%)
X----


Masz chyba o to chodzi:
  1. <?
  2. $path = "C:monster";
  3. $folder = opendir($path);
  4. print("<b>Monsters:</b><br>\n<ul>\n");
  5. while($filename = readdir($folder)) {
  6. if($filename == "." || $filename == "..") continue;
  7. $temp = explode(".", $filename);
  8. if($temp[1] == "xml") {
  9. $name = $temp[0];
  10. print("<li><a href=\"index.php?show=monster&name=$name\">$name</a>\n");
  11. }
  12. }
  13. print("\n</ul>");
  14. ?>

W miejsce $path umieśc link do plików .xml
W
  1. <?php
  2. <a href=&#092;"index.php?show=monster&name=$name\">
  3. ?>
umieść co chcesz. To są docelowe informacje pobierane z pliku. Jak chcesz moge ci też w tym pomóc.!
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 06:56