Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][XML]Co i jak?
Victor152
post
Post #1





Grupa: Zarejestrowani
Postów: 105
Pomógł: 3
Dołączył: 26.02.2008

Ostrzeżenie: (0%)
-----


Witam mam taki dokument xml:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <bans>
  3. <ban type="2" player="SaMoLoN" time="-1" reason="nothing"/>
  4. <ban type="2" player="AaaaaA" time="-1" reason="nothing"/>

I chce w tabelce z niego odcczytać type, player, time i reason.
Proszę o wskazówki.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Victor152
post
Post #2





Grupa: Zarejestrowani
Postów: 105
Pomógł: 3
Dołączył: 26.02.2008

Ostrzeżenie: (0%)
-----


To:
  1. <?php
  2. $domDocument = new DOMDocument;
  3. $domDocument->loadXML("bans.xml");
  4. $domXPath = new DOMXPath($domDocument);
  5. foreach ($domXPath->query('//ban') as $keyDOM) {
  6. echo $keyDOM->getAttribute('type');
  7. }
  8. ?>

Wyrzuca to:
Cytat
Warning: DOMDocument::loadXML() [domdocument.loadxml]: Start tag expected, '<' not found in Entity, line: 1 in C:\Program Files\xampp\htdocs\nikol\bans_xml.php on line 3

Any ideas?
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: 7.10.2025 - 06:49