Stop

Using

<XML>

Everywhere

Damn it!!!

Documents

Configuration files

Data

Serialized objects

XML is Everywhere

XML is turned into a Perl Data Structure

Works reasonably

but...

XML is UGLY!

Configuration Files

XML Version

<config logdir="/var/log/foo/"
debugfile="/tmp/foo.debug">
<server name="sahara" osname="solaris"
osversion="2.6">
<address>10.0.0.101</address>
<address>10.0.1.101</address>
</server>
<server name="gobi" osname="irix"
osversion="6.5">
<address>10.0.0.102</address>
<address>10.0.0.103</address>
</server>
</config>

YAML Version

Debugfile: '/tmp/foo.debug'
logdir: '/var/log/foo/'
server:
gobi:
address:
- 10.0.0.102
- 10.0.0.103
osname: irix
osversion: 6.5
sahara:
address:
- 10.0.0.101
- 10.0.1.101
osname: solaris
osversion: 2.6

Try this at home

perl -MYAML -MXML::Simple \

-e 'print Dump XMLin "conf.xml"'

XML for Data

Data lives in...

Data Bases!

Data Bases

Fast

Reliable

Multi-user

Scalable!

XML for data

It's just like text files...

...only slower!

Exporting XML

XML::Generator::DBI

XML::Handler::YAWriter

use DBI;
use XML::Generator::DBI;
use XML::Handler::YAWriter;

my $dbh= DBI->connect(...);

my $ya = XML::Handler::YAWriter->new(AsFile => "-");
my $generator = XML::Generator::DBI->new(
Handler => $ya, dbh => $dbh
);
$generator->execute('SELECT * FROM data');

Conclusion

Use XML when it makes sense

Don't use it just because it's a buzzword

THINK!

Michel Rodriguez

2003-07-09T00:09:02