Revision 279 (by dpavlin, 2004/03/14 14:59:43) Implemented new form of delimiters like this:

<tag>
<delimiter>, </delimiter>
<value>200a</value>
</tag>

which is equivavelnt to following old mark-up:

<tag delimiter=", ">200a</tag>

but, it won't loose spaces in attribute values (which
are invalid by XML specification and XML::Simple removes
them so WebPac never get them)
#!/usr/bin/perl -w

use strict;
use XML::Simple;
use IO::File;
use Data::Dumper;

my $xml = '<?xml version="1.0" encoding="ISO-8859-2"?>
<xml>
<isis delimiter=" aa ">foo</isis>
<isis>
	<delimiter> aa </delimiter>
	<format>foo</format>
</isis>

<test foo="a" foo_a=" a" foo_a_=" a " fooa_="a ">truæ</test>
</xml>';

my $xml_file = shift @ARGV;

if ($xml_file) {
	my $fh = new IO::File($xml_file) || die "can't open $xml_file: $!";
	$xml = XMLin($fh);
} else {
	$xml = XMLin($xml,
		ForceArray => [ 'isis', 'config', 'format' ],
		ForceContent => 1,
		NormaliseSpace => 0,
		KeyAttr => [ 'isis' ]
	);
}

print Dumper($xml),"\n";