Smart.Framework Logo

final class \SmartXmlComposer
{ } ->

Class: SmartXmlComposer - Create simple XML structure from a PHP Array.
XML tag attributes are not supported.


class Methods

public function __construct ( $encoding = "" ) {} @ 
public function transform ( array $y_array, $xmlroot = "xml" ) {} -> 

class Properties


class Constants


Sample code: PHP

<?php

//-- Sample use:
   
$array = array(
       
'id' => '15',
       
'name' => 'Test',
       
'data' => array(
           
'key1' => '12345',
           
'key2' => '67890',
           
'key3' => 'ABCDEF'
       
),
       
'date' => '2016-02-05 09:30:05'
   
);
   
$xml = (new SmartXmlComposer())->transform($array'myxml');
   echo 
$xml;
   
//-- will have something like:
   
<myxml>
     <
id>15</id>
     <
name>Test</name>
     <
data>
       <
key1>12345</key1>
       <
key2>67890</key2>
       <
key3>ABCDEF</key3>
     </
data>
     <
date>2016-02-05 09:30:05</date>
   </
myxml>
   
//--

// #end php code


documentation generated on: 2023-10-19 23:15:45 +0000


Smart.Framework © 2009-2023 unix-world.org