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 4444class XML2Array {
4545
4646 private static $ xml = null ;
47- private static $ encoding = 'UTF-8 ' ;
47+ private static $ encoding = 'UTF-8 ' ;
48+ private static $ prefix_attributes = '@ ' ;
4849
4950 /**
5051 * Initialize the root XML node [optional]
@@ -92,7 +93,7 @@ private static function &convert($node) {
9293
9394 switch ($ node ->nodeType ) {
9495 case XML_CDATA_SECTION_NODE :
95- $ output [' @ cdata ' ] = trim ($ node ->textContent );
96+ $ output [static :: $ prefix_attributes . ' cdata ' ] = trim ($ node ->textContent );
9697 break ;
9798
9899 case XML_TEXT_NODE :
@@ -142,9 +143,9 @@ private static function &convert($node) {
142143 }
143144 // if its an leaf node, store the value in @value instead of directly storing it.
144145 if (!is_array ($ output )) {
145- $ output = array (' @ value ' => $ output );
146+ $ output = array (static :: $ prefix_attributes . ' value ' => $ output );
146147 }
147- $ output [' @ attributes ' ] = $ a ;
148+ $ output [static :: $ prefix_attributes . ' attributes ' ] = $ a ;
148149 }
149150 break ;
150151 }
You can’t perform that action at this time.
0 commit comments