| XML-APML documentation | Contained in the XML-APML distribution. |
XML::APML::Profile - profile markup
my $home = XML::APML::Profile->new( name => 'Home' );
my $work = XML::APML::Profile->new;
$work->name('Work');
print $work->name;
my $implicit = $work->implicit_data;
my $explicit = $work->explicit_data;
Class that represents Profile mark-up for APML.
Constructor
my $p = XML::APML::Profile->new;
$p->name('Name');
my $p = XML::APML::Profile->new( name => 'Name' );
accessor for name
my $p = XML::APML::Profile->new;
$p->name('ProfileName');
print $p->name;
returns XML::APML::ImplicitData object.
my $implicit = $p->implicit_data;
my @concepts = $implicit->concepts;
alias for implicit_data
returns XML::APML::ExplicitData object.
my $explicit = $p->explicit_data;
my @concepts = $explicit->concepts;
alias for explicit_data
| XML-APML documentation | Contained in the XML-APML distribution. |
package XML::APML::Profile; use strict; use warnings; use base 'Class::Accessor::Fast'; __PACKAGE__->mk_accessors(qw/implicit_data explicit_data name/); use XML::APML::ImplicitData; use XML::APML::ExplicitData; *implicit = \&implicit_data; *explicit = \&explicit_data;
sub new { my ($class, %args) = @_; my $self = bless { implicit_data => XML::APML::ImplicitData->new, explicit_data => XML::APML::ExplicitData->new, }, $class; $self->{name} = exists $args{name} ? delete $args{name} : undef; $self; } sub parse_node { my $class = shift; my $node = shift; my $profile = $class->new; my $name = $node->getAttribute('name'); $profile->name($name) if (defined $name && $name ne ''); my @enodes = $node->findnodes('*[local-name()=\'ExplicitData\']'); if (@enodes) { $profile->explicit_data(XML::APML::ExplicitData->parse_node($enodes[0])); } my @inodes = $node->findnodes('*[local-name()=\'ImplicitData\']'); if (@inodes) { $profile->implicit_data(XML::APML::ImplicitData->parse_node($inodes[0])); } $profile; } sub build_dom { my ($self, $doc) = @_; my $elem = $doc->createElement('Profile'); $elem->setAttribute(name => $self->name); $elem->appendChild($self->implicit_data->build_dom($doc)); $elem->appendChild($self->explicit_data->build_dom($doc)); $elem; } 1;