Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> bledne odczytywanie z xml
ilkar
post
Post #1





Grupa: Zarejestrowani
Postów: 131
Pomógł: 0
Dołączył: 20.08.2007

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


Hej

używam xml reader, z kodem poniżej

CODE
while($reader->read()){
switch ($reader->localName) {
case "preSIEF":
if ($reader->hasAttributes){
$reader->moveToAttribute("id");
$substance[] = $reader->value;
$reader->moveToAttribute("creationDate");
$substance[] = $reader->value;
$reader->moveToAttribute("exportDate");
$substance[] = $reader->value;
}
break;
case "substanceIdentity":

while($reader->read()){
switch ($reader->name) {
case "ECIdentity":
if($reader->depth == '3'){
$reader->moveToFirstAttribute();
$substance[] = $reader->value;
$reader->moveToNextAttribute();
}
break;
case "name":
if($reader->depth == '4'){
$reader->read();
$substance[] = $reader->value;
}
break;
}
}
break;
}
}


moim problemem jest to, ze nie wiem z jakiego powodu, ale petla 2 razy wpisuje mi to samo do macierzy, czyli np w $substance[1] = '111111' i w $substance[2] = '111111'

jak to obejsc?
Go to the top of the page
+Quote Post

Posty w temacie
- ilkar   bledne odczytywanie z xml   14.07.2009, 13:56:47
- - fly474   Hej Zamiast: Kodif ($reader->hasAttr...   14.07.2009, 14:44:56
- - Spawnm   Hey , proszę dodać tagi do tematu   14.07.2009, 15:07:51


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

 



RSS Aktualny czas: 20.08.2025 - 18:27