2017 © Pedro Peláez
 

library xml

easy to read and write xml

image

bileji/xml

easy to read and write xml

  • Friday, March 18, 2016
  • by shuc324
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

XML 读写

$xmlIo = new XmlIO();

读:

$xmlIo->read('./recipe.xml');

如果你有如下一个xml文件 './recipe.xml':, (*1)

<?xml version="1.0" encoding="UTF-8"?>
<recipe keywords="attribute">
    <preptime>5 minutes</preptime>
    <recipename>Ice Cream Sundae</recipename>
    <ingredlist>
        <listitem>
            <quantity>1</quantity>
            <itemdescription>nuts</itemdescription>
        </listitem>
        <listitem>
            <quantity>1</quantity>
            <itemdescription>cherry</itemdescription>
        </listitem>
    </ingredlist>
</recipe>

你将得到这样一个数组:, (*2)

array (
  'recipe' => 
  array (
    0 => 
    array (
      '@attributes' => 
      array (
        'keywords' => 'attribute',
      ),
      'preptime' => '5 minutes',
      'recipename' => 'Ice Cream Sundae',
      'ingredlist' => 
      array (
        'listitem' => 
        array (
          0 => 
          array (
            'quantity' => '1',
            'itemdescription' => 'nuts',
          ),
          1 => 
          array (
            'quantity' => '1',
            'itemdescription' => 'cherry',
          ),
        ),
      ),
    ),
  ),
)

写:

$xmlIo->write('./recipe.xml', $xmldata);

注: xmldata数据格式参数读时的输出数组格式, (*3)

The Versions

18/03 2016

dev-master

9999999-dev

easy to read and write xml

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar shuc324

18/03 2016

1.0.0

1.0.0.0

easy to read and write xml

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar shuc324