File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 44
44
class XML2Array {
45
45
46
46
private static $ xml = null ;
47
- private static $ encoding = 'UTF-8 ' ;
47
+ private static $ encoding = 'UTF-8 ' ;
48
+ private static $ prefix_attributes = '@ ' ;
48
49
49
50
/**
50
51
* Initialize the root XML node [optional]
@@ -92,7 +93,7 @@ private static function &convert($node) {
92
93
93
94
switch ($ node ->nodeType ) {
94
95
case XML_CDATA_SECTION_NODE :
95
- $ output [' @ cdata ' ] = trim ($ node ->textContent );
96
+ $ output [static :: $ prefix_attributes . ' cdata ' ] = trim ($ node ->textContent );
96
97
break ;
97
98
98
99
case XML_TEXT_NODE :
@@ -142,9 +143,9 @@ private static function &convert($node) {
142
143
}
143
144
// if its an leaf node, store the value in @value instead of directly storing it.
144
145
if (!is_array ($ output )) {
145
- $ output = array (' @ value ' => $ output );
146
+ $ output = array (static :: $ prefix_attributes . ' value ' => $ output );
146
147
}
147
- $ output [' @ attributes ' ] = $ a ;
148
+ $ output [static :: $ prefix_attributes . ' attributes ' ] = $ a ;
148
149
}
149
150
break ;
150
151
}
You can’t perform that action at this time.
0 commit comments