/[webpac]/trunk2/tests/test_xml_simple.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk2/tests/test_xml_simple.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 279 - (show annotations)
Sun Mar 14 14:59:43 2004 UTC (20 years ago) by dpavlin
Original Path: trunk/tests/test_xml_simple.pl
File MIME type: text/plain
File size: 628 byte(s)
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)

1 #!/usr/bin/perl -w
2
3 use strict;
4 use XML::Simple;
5 use IO::File;
6 use Data::Dumper;
7
8 my $xml = '<?xml version="1.0" encoding="ISO-8859-2"?>
9 <xml>
10 <isis delimiter=" aa ">foo</isis>
11 <isis>
12 <delimiter> aa </delimiter>
13 <format>foo</format>
14 </isis>
15
16 <test foo="a" foo_a=" a" foo_a_=" a " fooa_="a ">truæ</test>
17 </xml>';
18
19 my $xml_file = shift @ARGV;
20
21 if ($xml_file) {
22 my $fh = new IO::File($xml_file) || die "can't open $xml_file: $!";
23 $xml = XMLin($fh);
24 } else {
25 $xml = XMLin($xml,
26 ForceArray => [ 'isis', 'config', 'format' ],
27 ForceContent => 1,
28 NormaliseSpace => 0,
29 KeyAttr => [ 'isis' ]
30 );
31 }
32
33 print Dumper($xml),"\n";
34

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26