# final class \SmartXmlComposer
{ } ->

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

- Language: PHP
- Located at: lib/framework/plugins/lib_xml.php
- Package: Plugins:ConvertersAndParsers
- Namespace: \
- Class Name: SmartXmlComposer
- Version: v.20231207
- Depends: classes: Smart
- Hints: -
- Usage: dynamic object: (new Class())->method() - This class provides only DYNAMIC methods

## 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 16:53:45 +0000

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