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


my %StrictMode     = ();

my @KnownOptIn     = qw(keyattr keeproot forcecontent contentkey noattr
                        searchpath forcearray cache suppressempty parseropts
                        grouptags nsexpand datahandler varattr variables
                        normalisespace normalizespace valueattr strictmode);

my @KnownOptOut    = qw(keyattr keeproot contentkey noattr
                        rootname xmldecl outputfile noescape suppressempty
                        grouptags nsexpand handler noindent attrindent nosort
                        valueattr numericescape strictmode);

my @DefKeyAttr     = qw(name key id);
my $DefRootName    = qq(opt);
my $DefContentKey  = qq(content);
my $DefXmlDecl     = qq(<?xml version='1.0' standalone='yes'?>);

my $xmlns_ns       = 'http://www.w3.org/2000/xmlns/';
my $bad_def_ns_jcn = '{' . $xmlns_ns . '}';     # LibXML::SAX workaround

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" />

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.894 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )