2017 © Pedro Peláez
 

symfony-bundle xml-bundle

Symfony XmlBundle

image

desperado/xml-bundle

Symfony XmlBundle

  • Wednesday, December 2, 2015
  • by pravednik
  • Repository
  • 3 Watchers
  • 7 Stars
  • 36,856 Installations
  • PHP
  • 2 Dependents
  • 1 Suggesters
  • 7 Forks
  • 1 Open issues
  • 9 Versions
  • 17 % Grown

The README.md

Build
Status SensioLabsInsight Latest Stable Version License Total Downloads, (*1)

XML Builder/Reader Bundle for Symfony2, (*2)

Installation

Using composer, (*3)

Add desperado/xml-bundle to your composer.json file., (*4)

     "require": {
         "desperado/xml-bundle": "dev-master"
     }

The next thing you should do is install the bundle by executing the following command:, (*5)

php composer.phar update desperado/xml-bundle

Finally, add the bundle to the registerBundles function of the AppKernel class in the app/AppKernel.php file:, (*6)

public function registerBundles()
{
    $bundles = array(
        ...
        new Desperado\XmlBundle\DesperadoXmlBundle,
        ...
    );

Usage

DIC

  • XmlEditor: desperado_xml.model.xml_editor
  • XmlGenerator: desperado_xml.model.xml_generator
  • XmlReader: desperado_xml.model.xml_reader
  • XmlPrepare: desperado_xml.model.xml_prepare

Create xml from array

 [
                '@ns'               => [
                    '0_xmlns' => ['prefix' => 'xsi', 'uri' => 'http//www.w3.org/2001/XMLSchema-instance'],
                    '1_xmlns' => ['prefix' => 'xsd', 'uri' => 'http//www.w3.org/2001/XMLSchema'],
                ],
                '@attrib'           => [
                    'Id'      => 100,
                    'Service' => 200,
                    'xmlns'   => 'http://ekassir.com/ekassir/PaySystem/Server/eKassirV3Protocol'
                ],
                'PaymentParameters' => [
                    '@attrib'   => ['xmlns' => ''],
                    'Parameter' => [
                        '@attrib' => ['Name' => 'account'],
                        '@value'  => 'emptyAccount'
                    ]

                ]
            ]
        ];


        $xmlGenerator = new XmlGenerator;

        echo $xmlGenerator->generateFromArray($params);
```
prints:

```xml

<root xmlns:xsi="http//www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http//www.w3.org/2001/XMLSchema">
  <Request xmlns="http://ekassir.com/ekassir/PaySystem/Server/eKassirV3Protocol" xmlns:xsi="http//www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http//www.w3.org/2001/XMLSchema" Id="100" Service="200" xsi:xmlns="" xsd:xmlns="">
    <PaymentParameters xmlns="">
      <Parameter Name="account">emptyAccount</Parameter>
    </PaymentParameters>
  </Request>
</root>

Create XML without attributes, namespaces, etc.

 [
                'PaymentParameters' => [
                    'first_node'  => 'first_node_value',
                    'second_node' => 'second_node_value'
                ]
            ]
        ];


        $xmlPrepare = new XmlPrepare;
        $xmlGenerator = new XmlGenerator;

        echo $xmlGenerator->setRootName('request')->generateFromArray($xmlPrepare->prepareArrayBeforeToXmlConvert($params));
```
prints:

```xml

<request>
  <Details>
    <PaymentParameters>
      <first_node>first_node_value</first_node>
      <second_node>second_node_value</second_node>
    </PaymentParameters>
  </Details>
</request>

Parse XML without attributes, namespaces, etc.


                      <request>
                          <Details>
                              <PaymentParameters>
                                  <first_node>first_node_value</first_node>
                                  <second_node>second_node_value</second_node>
                              </PaymentParameters>
                          </Details>
                      </request>';

        $xmlReader = new XmlReader;

        print_r($xmlReader->processConvert($xmlString));

prints:, (*7)

Array
(
    [Details] => Array
        (
            [PaymentParameters] => Array
                (
                    [first_node] => first_node_value
                    [second_node] => second_node_value
                )

        )

)

The Versions

02/12 2015

dev-master

9999999-dev

Symfony XmlBundle

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar Desperado

xml generator xml reader xml formatter

02/12 2015

dev-patch-1

dev-patch-1

Symfony XmlBundle

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar Desperado

xml generator xml reader xml formatter

16/04 2015

0.1.7

0.1.7.0

Symfony XmlBundle

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar Desperado

xml generator xml reader xml formatter

12/04 2015

0.1.6

0.1.6.0

Symfony XmlBundle

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar Desperado

xml generator xml reader xml formatter

26/01 2015

0.1.5

0.1.5.0

Symfony XmlBundle

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar Desperado

xml generator xml reader xml formatter

26/01 2015

0.1.4

0.1.4.0

Symfony XmlBundle

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar Desperado

xml generator xml reader xml formatter

25/08 2014

0.1.3

0.1.3.0

Symfony XmlBundle

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar Desperado

xml generator xml reader xml formatter

21/07 2014

0.1.2

0.1.2.0

Symfony XmlBundle

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Avatar Desperado

xml generator xml reader xml formatter

21/07 2014

0.1.1

0.1.1.0

Symfony XmlBundle

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Avatar Desperado

xml generator xml reader xml formatter