Gennadiy Filatov

NAME

Salvation::Service::View::Stack::Convert::To::XML - Salvation::Service::View::Stack to XML converter

SYNOPSIS

 my $writer = XML::Writer -> new( ... );

 my %args = (
        writer => $writer,
        charset => 'UTF-8',
        nocharset => 0,
        tags => {
                stack => 'stack_xml_tag',
                list => 'list_xml_tag',
                frame => 'frame_xml_tag'
        },
        events => {
                ...
        }
 );

 Salvation::Service::View::Stack::Convert::To::XML
        -> parse(
                $stack,
                \%args
        )
 ;

REQUIRES

XML::Writer

IO::String

DESCRIPTION

Wraps over

Salvation::Service::View::Stack::Parser

METHODS

parse

 Salvation::Service::View::Stack::Convert::To::XML -> parse( $stack, \%args );

Is just a wrapped Salvation::Service::View::Stack::Parser::parse call.

Returns generated XML as plain text.

%args can hold following additional keys:

writer

An XML::Writer object instance.

charset

XML charset. String. An argument to XML::Writer::xmlDecl. Default is UTF-8.

nocharset

Boolean. Indicates whether Salvation::Service::View::Stack::Convert::To::XML should set XML charset and produce xml declaration, or not. Default is true.

tags

A HashRef. Tells parser which XML tags to use.

It can contain:

stack

A tag representing a stack itself. Default is stack which produces following XML:

 <stack>...</stack>
list

A tag representing a frame list. Default is list which produces following XML:

 <list name="fname">...</list>
frame

A tag representing a single frame. Default is frame which produces following XML:

 <frame title="cap" name="fname" type="ftype">...</frame>

This module uses following event handlers:

  • before_stack

  • after_stack

  • before_frame_list

  • after_frame_list

  • before_frame_single

  • after_frame_single

  • raw

Each %args key is optional.

You can set other event handlers and redefine the ones set by the parser itself.