XML-Simple

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


2.12  Apr 05 2004
  - added NumericEscape option
  - added ValueAttr option (patch from Anton Berezin)
  - suppress 'wide character in print' warning (reported by Dawei Lin)

2.11  Mar 02 2004
  - Fixed hash ordering assumption in a new test (reported by Jost Krieger)

2.10  Feb 29 2004
  - Added AttrIndent option (patch from Volker Moell)
  - Hash keys are now sorted alphabetically by default; enable the
    new NoSort option if you don't want this (patch from Volker Moell)
  - Fixed bug where disabling array folding broke anonymous array handling
  - Fixed bug when unfolding a tied hash
  - SuppressEmpty patch from Douglas Wilson
  - Numerous test improvements - Devel::Cover rocks!
  - POD update re XMLin(XMLout($data)) caveats (bug report from Slaven
    Rezic)

2.09  Sep 09 2003

lib/XML/Simple.pm  view on Meta::CPAN


=back

The options are listed alphabetically:

Note: option names are no longer case sensitive so you can use the mixed case
versions shown here; all lower case as required by versions 2.03 and earlier;
or you can add underscores between the words (eg: key_attr).


=head2 AttrIndent => 1 I<# out - handy>

When you are using C<XMLout()>, enable this option to have attributes printed
one-per-line with sensible indentation rather than all on one line.

=head2 Cache => [ cache schemes ] I<# in - advanced>

Because loading the B<XML::Parser> module and parsing an XML file can consume a
significant number of CPU cycles, it is often desirable to cache the output of
C<XMLin()> for later reuse.

t/2_XMLout.t  view on Meta::CPAN

  <opt>
    (
    <person(\s+name="bob"|\s+age="25"){2}\s*/>
    |<person(\s+name="kate"|\s+age="22"){2}\s*/>
    ){2}
  </opt>
}sx,
'NoIndent worked ok with KeyAttr');


# Try the 'AttrIndent' option (assume NoSort defaults to off)

$ref = {
  beta => '2',
  gamma => '3',
  alpha => '1',
  colours => {
    red => '#ff0000',
    green => '#00ff00',
  }
};

$_ = XMLout($ref, AttrIndent => 1, RootName => 'opt');

is($_, '<opt alpha="1"
     beta="2"
     gamma="3">
  <colours green="#00ff00"
           red="#ff0000" />
</opt>
', 'AttrIndent seems to work');


# Test the attribute/element sorting algorithm

$xml = q{
<opt>
  <test id="beta"  animal="elephant" vegetable="carrot" />
  <test id="gamma" animal="tiger"    vegetable="turnip" />
  <test id="alpha" animal="giraffe"  vegetable="pumpkin" />
  <box size="small" key="a" />



( run in 0.403 second using v1.01-cache-2.11-cpan-a5abf4f5562 )