XML-Filter-Essex

 view release on metacpan or  search on metacpan

lib/XML/Generator/Essex.pm  view on Meta::CPAN

Emits one or more data structures as XML.  Returns the result of
emitting the last event (ie the result from the next SAX processor).

Most of the things you can pass to put (strings, constructed events) are
relatively self evident.

For instance, you can pass any events you construct, so an Essex script
to make sure all character data is emitted in CDATA sections might look
like:

    get( "text()" ), put cdata $_ while 1;

A less obvious feature is that you can pass a (possibly nested) Perl
ARRAY that defines an XML tree to emit:

   put [
       root => { id => 1 },              ## HASHes contain attributes
           "root content",
           [ a => "a content" ],
           "more root content",
           [ b => { id => 2 }, "b content" ],

lib/XML/SAX/Writer/XML.pm  view on Meta::CPAN

    else {
        $dtd = ' ]>';
    }
    $dtd = $self->{Encoder}->convert($dtd);
    $self->{Consumer}->output($dtd);
    $self->{BufferDTD} = '';
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# start_cdata
#-------------------------------------------------------------------#
sub start_cdata {
    my $self = shift;
    $self->_output_element;

    $self->{InCDATA} = 1;
    my $cds = $self->{Encoder}->convert('<![CDATA[');
    $self->{Consumer}->output($cds);
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# end_cdata
#-------------------------------------------------------------------#
sub end_cdata {
    my $self = shift;

    $self->{InCDATA} = 0;
    my $cds = $self->{Encoder}->convert(']]>');
    $self->{Consumer}->output($cds);
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# start_entity



( run in 1.821 second using v1.01-cache-2.11-cpan-995e09ba956 )