[Scribus] XML parser in Perl
Gregory Pittman
gpittman
Sun Jun 11 17:24:37 CEST 2006
Andreas invited comments in his blog post:
http://rants.scribus.net/2006/06/06/do-you-enjoy-parsing-xml/
Perl has some very nice parsing capabilities, once you get beyond the
potential well-formedness problem. In general, the well-formedness is
likely going to be a problem in any .sla file containing text, since
that's where Scribus sticks in its illegal characters.
But this short little perl program will parse nicely if you don't have
these characters, and show a nice display of the tags in the file:
<begin perl program>
#! /usr/bin/env perl
# this is from Perl & XML,
# ET Ray & J McIntosh
# O'Reilly & Associates, 2002
# Example 3-3, p 46
use XML::Parser;
$parser = new XML::Parser( Style => 'Tree' );
my $tree = $parser->parsefile( shift @ARGV );
use Data::Dumper;
print Dumper( $tree );
<end perl program>
Greg
More information about the scribus
mailing list