XML-MinWriter
view release on metacpan or search on metacpan
lib/XML/MinWriter.pm view on Meta::CPAN
sub raw { my $self = shift; $self->flush_pyx; $self->SUPER::raw(@_); }
sub cdata { my $self = shift; $self->flush_pyx; $self->SUPER::cdata(@_); }
sub dataElement { my $self = shift; $self->flush_pyx; $self->SUPER::dataElement(@_); }
sub end { my $self = shift; $self->flush_pyx; $self->SUPER::end(@_); }
sub write_pyx {
my $self = shift;
my @inlist;
for (@_) {
push @inlist, split m{\n}xms;
}
LOOP1: for my $instr (@inlist) {
if ($instr eq '') {
next LOOP1;
}
my $code = substr($instr, 0, 1);
my $text = substr($instr, 1);
t/0010_test.t view on Meta::CPAN
$wrt->write_pyx(')data');
}
$wrt->end;
close $fh;
$xml =~ s{\n}"%n"xmsg;
$xml =~ s{ [ ] }'.'xmsg;
$xml =~ s{\t}"%t"xmsg;
my @xlines = split m{(< [^>]* >)}xms, $xml;
is(scalar(@xlines), 17, 'Test-PYX1-0300: Number of lines in XML correct');
is($wrn, q{}, 'Test-PYX1-0305: No Warning emitted');
is($xlines[ 0], q{}, 'Test-PYX1-0310');
is($xlines[ 1], q{<?xml.version="1.0".encoding="iso-8859-1"?>}, 'Test-PYX1-0320');
is($xlines[ 2], q{%n%n}, 'Test-PYX1-0330');
is($xlines[ 3], q{<data>}, 'Test-PYX1-0340');
is($xlines[ 4], q{%n..}, 'Test-PYX1-0350');
is($xlines[ 5], q{<item.attr1="p1".attr2="p2">}, 'Test-PYX1-0360');
( run in 0.686 second using v1.01-cache-2.11-cpan-71847e10f99 )