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 ( string $encoding = "" ) {} @ 
public function transform ( array $y_array, string $xmlroot = "xml" ) {} -> STRING

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: 2024-12-16 17:13:19 +0000


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