Uitlezen XML Array
Ik heb een array, gelezen uit een XML file, welke als volgt is:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php [ranglijst] => SimpleXMLElement Object
(
[rang] => Array
(
[0] => SimpleXMLElement Object
(
[positie] => 1
[team] => Lemelerveld 1
)
[1] => SimpleXMLElement Object
(
[positie] => 2
[team] => Colmschate 1
)
[2] => SimpleXMLElement Object
(
[positie] => 3
[team] => ABS 1
)
[3] => SimpleXMLElement Object
(
[positie] => 4
[team] => IJsselstreek 1
)
[4] => SimpleXMLElement Object
(
[positie] => 5
[team] => Activia 1
)
[5] => SimpleXMLElement Object
(
[positie] => 6
[team] => Diepenveen 1
)
[6] => SimpleXMLElement Object
(
[positie] => 7
[team] => DAVO 1
)
[7] => SimpleXMLElement Object
(
[positie] => 8
[team] => Hattem 1
)
[8] => SimpleXMLElement Object
(
[positie] => 9
[team] => RDC 1
)
[9] => SimpleXMLElement Object
(
[positie] => 10
[team] => OVC '21 1
)
[10] => SimpleXMLElement Object
(
[positie] => 11
[team] => Wilp 1
)
[11] => SimpleXMLElement Object
(
[positie] => 12
[team] => USV 1
)
)
)
?>
(
[rang] => Array
(
[0] => SimpleXMLElement Object
(
[positie] => 1
[team] => Lemelerveld 1
)
[1] => SimpleXMLElement Object
(
[positie] => 2
[team] => Colmschate 1
)
[2] => SimpleXMLElement Object
(
[positie] => 3
[team] => ABS 1
)
[3] => SimpleXMLElement Object
(
[positie] => 4
[team] => IJsselstreek 1
)
[4] => SimpleXMLElement Object
(
[positie] => 5
[team] => Activia 1
)
[5] => SimpleXMLElement Object
(
[positie] => 6
[team] => Diepenveen 1
)
[6] => SimpleXMLElement Object
(
[positie] => 7
[team] => DAVO 1
)
[7] => SimpleXMLElement Object
(
[positie] => 8
[team] => Hattem 1
)
[8] => SimpleXMLElement Object
(
[positie] => 9
[team] => RDC 1
)
[9] => SimpleXMLElement Object
(
[positie] => 10
[team] => OVC '21 1
)
[10] => SimpleXMLElement Object
(
[positie] => 11
[team] => Wilp 1
)
[11] => SimpleXMLElement Object
(
[positie] => 12
[team] => USV 1
)
)
)
?>
Nu probeer ik deze uit te lezen adhv de volgende code:
Code (php)
Echter, het resultaat is:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
1
2: Colmschate 1
3: ABS 1
4: IJsselstreek 1
5: Activia 1
6: Diepenveen 1
7: DAVO 1
8: Hattem 1
9: RDC 1
10: OVC '21 1
11: Wilp 1
12: USV 1
?>
1
2: Colmschate 1
3: ABS 1
4: IJsselstreek 1
5: Activia 1
6: Diepenveen 1
7: DAVO 1
8: Hattem 1
9: RDC 1
10: OVC '21 1
11: Wilp 1
12: USV 1
?>
Zoals te zien is, wordt het eerste resultaat niet uitgelezen. Hoe komt dit? Doe ik iets verkeerd?
Groet!
Gewijzigd op 24/11/2012 14:55:38 door Roeltje M
Gewijzigd op 24/11/2012 14:25:56 door Frits Katoen
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(1) "1"
["team"]=>
string(14) "Lemelerveld 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(1) "2"
["team"]=>
string(13) "Colmschate 1 "
}
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(1) "3"
["team"]=>
string(6) "ABS 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(1) "4"
["team"]=>
string(15) "IJsselstreek 1 "
}
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(1) "5"
["team"]=>
string(10) "Activia 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(1) "6"
["team"]=>
string(13) "Diepenveen 1 "
}
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(1) "7"
["team"]=>
string(7) "DAVO 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(1) "8"
["team"]=>
string(9) "Hattem 1 "
}
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(1) "9"
["team"]=>
string(6) "RDC 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(2) "10"
["team"]=>
string(10) "OVC '21 1 "
}
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(2) "11"
["team"]=>
string(7) "Wilp 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(2) "12"
["team"]=>
string(6) "USV 1 "
}
?>
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(1) "1"
["team"]=>
string(14) "Lemelerveld 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(1) "2"
["team"]=>
string(13) "Colmschate 1 "
}
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(1) "3"
["team"]=>
string(6) "ABS 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(1) "4"
["team"]=>
string(15) "IJsselstreek 1 "
}
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(1) "5"
["team"]=>
string(10) "Activia 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(1) "6"
["team"]=>
string(13) "Diepenveen 1 "
}
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(1) "7"
["team"]=>
string(7) "DAVO 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(1) "8"
["team"]=>
string(9) "Hattem 1 "
}
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(1) "9"
["team"]=>
string(6) "RDC 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(2) "10"
["team"]=>
string(10) "OVC '21 1 "
}
object(SimpleXMLElement)#25 (2) {
["positie"]=>
string(2) "11"
["team"]=>
string(7) "Wilp 1 "
}
object(SimpleXMLElement)#26 (2) {
["positie"]=>
string(2) "12"
["team"]=>
string(6) "USV 1 "
}
?>
Reset(); werkt ook niet :(
Ja nu wel, geen extra errors
Heb je nog html code ervoor staan? Misschien een html tag die niet helemaal afgesloten is ofzo? Als je bestand nog uit meer code bestaat, sloop al het overbodige eruit en check het dan nog eens?