![]() |
![]() |
![]() ![]()
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: 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 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 3.10.2025 - 02:06 |