XML::APML::Application - Application markup


XML-APML documentation Contained in the XML-APML distribution.

Index


Code Index:

NAME

Top

XML::APML::Application - Application markup

SYNOPSIS

Top

    my $app = XML::APML::Application->new;
    $app->name('My Application');

    $apml->add_application($app);

    foreach my $application ($apml->applications) {
      print $application->name;
    }

DESCRIPTION

Top

Class that represents Application mark-up for APML.

METHODS

Top

new

Constructor

  my $app = XML::APML::Application->new;

  my $app = XML::APML::Application->new( name => 'My Application' );

name

elem


XML-APML documentation Contained in the XML-APML distribution.

package XML::APML::Application;

use strict;
use warnings;

use base 'Class::Accessor::Fast';

__PACKAGE__->mk_accessors(qw/elem name/);

sub new {
    my $class = shift;
    bless {
        name => undef,
        elem => undef,
    }, $class;
}

sub parse_node {
    my ($class, $node) = @_;
    my $app = $class->new;
    my $name = $node->getAttribute('name');
    $app->name($name);
    $app->elem($node->cloneNode(1));
    $app;
}

sub build_dom {
    my ($self, $doc) = @_;
    my $elem = $doc->createElement('Application');
    my $name = $self->name;
    Carp::croak(q{name is needed.}) unless (defined $name && $name ne '');
    $elem->setAttribute(name => $name);
    foreach my $node ( $self->elem->childNodes ) {
        $elem->addChild($node);
    }
    $elem;
}

1;