![]() |
![]() ![]() |
![]() |
![]() ![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 623 Pomógł: 11 Dołączył: 1.01.2009 Skąd: Wrocław Ostrzeżenie: (0%) ![]() ![]() |
Witam, mam taki plik XML:
Kod <?xml version="1.0" encoding="utf-8"?> <notes> <note> <date id="123">2007-06-24</date> <heading>qwerty</heading> <body>asd</body> </note> <note> <date id="456">2008-01-04</date> <heading>qwerty2</heading> <body>asd2</body> </note> </notes> i taki plik PHP, który zajmuje się przetwarzaniem pliku:
W wyniku otrzymuję coś takiego: Cytat date() 2007-06-24 heading qwerty body asd date() 2008-01-04 heading qwerty2 body asd2 Mój problem polega na tym, że w nawiasach za słówkiem "date" nie wyświetla się wartość id z pliku XML. Co jest źle? -------------------- |
|
|
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 115 Pomógł: 23 Dołączył: 27.06.2009 Skąd: Jaworzno Ostrzeżenie: (0%) ![]() ![]() |
zrobiłem coś takiego
![]()
http://paw-e-l.net/parser.php nie znam przyczyny ale rozwiązanie polega na wypisaniu atrybutu pochodzącego z poprzedniego tagu ![]() Ten post edytował paw-e-l 23.09.2009, 21:54:41 |
|
|
![]()
Post
#3
|
|
![]() Grupa: Zarejestrowani Postów: 623 Pomógł: 11 Dołączył: 1.01.2009 Skąd: Wrocław Ostrzeżenie: (0%) ![]() ![]() |
Wielkie dzięki za szybką odpowiedź.
Trochę dodałem do pliku XML: Kod </P><P><?xml version="1.0" encoding="utf-8"?> <notes> <note> <date id="123">2007-06-24</date> <heading>qwerty</heading> <body>asd</body> <hello> <today id="1"> <morning>hi</morning> <afternoon>hi</afternoon> <evening>hi</evening> </today> <today id="2"> <morning>hi</morning> <afternoon>hi</afternoon> <evening>hi</evening> </today> </hello> </note> <note> <date id="456">2008-01-04</date> <heading>qwerty2</heading> <body>asd2</body> </note> </notes> </P><P> A plik php wygląda teraz tak:
W wyniku dostaję coś takiego: Cytat date(123) 2007-06-24 heading qwerty body asd - - - morning hi - - - afternoon hi - - - evening hi - - - morning hi - - - afternoon hi - - - evening hi date(456) 2008-01-04 heading qwerty2 body asd2 mi jednak chodzi coś takiego: Cytat date(123) 2007-06-24 heading qwerty body asd - hello() hello-text - - today(1) today-text - - - morning hi - - - afternoon hi - - - evening hi - - - morning hi - - - afternoon hi - - - evening hi date(456) 2008-01-04 heading qwerty2 body asd2 Taki wynik dostaję tylko wtedy, gdy plik XML wygląda tak: Kod <?xml version="1.0" encoding="utf-8"?> <notes> <note> <date id="123">2007-06-24</date> <heading>qwerty</heading> <body>asd</body> <hello> hello-text <today id="1"> today-text <morning>hi</morning> <afternoon>hi</afternoon> <evening>hi</evening> </today> <today id="2"> <morning>hi</morning> <afternoon>hi</afternoon> <evening>hi</evening> </today> </hello> </note> <note> <date id="456">2008-01-04</date> <heading>qwerty2</heading> <body>asd2</body> </note> </notes> Jedyne co zostało dodane do pliku xml to "hello-text" i "today-text". Czemu w wyniku nie wypisuje mi tych linijek, jeżeli usunę "hello-text" i "today-text": Cytat - hello() hello-text - - today(1) today-text -------------------- |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 29.06.2025 - 21:30 |