1--TEST--
2Test xml_parse_into_struct() function : variation
3--SKIPIF--
4<?php
5if (!extension_loaded("xml")) {
6	print "skip - XML extension not loaded";
7}
8?>
9--FILE--
10<?php
11/* Prototype  : proto int xml_parse_into_struct(resource parser, string data, array &struct, array &index)
12 * Description: Parsing a XML document
13 * Source code: ext/xml/xml.c
14 * Alias to functions:
15 */
16
17echo "*** Testing xml_parse_into_struct() : variation ***\n";
18
19$simple = "<main><para><note>simple note</note></para><para><note>simple note</note></para></main>";
20$p = xml_parser_create();
21xml_parse_into_struct($p, $simple, $vals, $index);
22xml_parser_free($p);
23echo "Index array\n";
24print_r($index);
25echo "\nVals array\n";
26print_r($vals);
27
28
29echo "Done";
30?>
31--EXPECT--
32*** Testing xml_parse_into_struct() : variation ***
33Index array
34Array
35(
36    [MAIN] => Array
37        (
38            [0] => 0
39            [1] => 7
40        )
41
42    [PARA] => Array
43        (
44            [0] => 1
45            [1] => 3
46            [2] => 4
47            [3] => 6
48        )
49
50    [NOTE] => Array
51        (
52            [0] => 2
53            [1] => 5
54        )
55
56)
57
58Vals array
59Array
60(
61    [0] => Array
62        (
63            [tag] => MAIN
64            [type] => open
65            [level] => 1
66        )
67
68    [1] => Array
69        (
70            [tag] => PARA
71            [type] => open
72            [level] => 2
73        )
74
75    [2] => Array
76        (
77            [tag] => NOTE
78            [type] => complete
79            [level] => 3
80            [value] => simple note
81        )
82
83    [3] => Array
84        (
85            [tag] => PARA
86            [type] => close
87            [level] => 2
88        )
89
90    [4] => Array
91        (
92            [tag] => PARA
93            [type] => open
94            [level] => 2
95        )
96
97    [5] => Array
98        (
99            [tag] => NOTE
100            [type] => complete
101            [level] => 3
102            [value] => simple note
103        )
104
105    [6] => Array
106        (
107            [tag] => PARA
108            [type] => close
109            [level] => 2
110        )
111
112    [7] => Array
113        (
114            [tag] => MAIN
115            [type] => close
116            [level] => 1
117        )
118
119)
120Done
121