PerlPoint-Generator-XML

 view release on metacpan or  search on metacpan

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

# = CODE SECTION =========================================================================

# precompile patterns
my $patternTagTrans=qr(^([-\w]+):([-\w]+)$);

# declare XML tags (TODO: should it become part of the object so that derived classes
# can access and adapt it?)
my %xmltags=(
             # document root and other structures
             __root          => 'presentation',
             __docdata       => 'docdata',
             __slides        => 'slides',
             __slide         => 'slide',

             # document data (meta data)
             _title          => 'title',
             _author         => 'author',
             _description    => 'description',

             # paragraph entities
             headline        => 'headline',

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

Please refer to the Artistic License that came with your Perl
distribution for more details.

=cut


# the DATA section contains the DTD
__DATA__

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT =__root= (=__docdata=, =__slides=)>
<!ELEMENT =__docdata= (=_author=, =_title=)>
<!ELEMENT =_author= (#PCDATA)>
<!ELEMENT =_title=  (#PCDATA)>
<!ELEMENT =__slides= (=__slide=+)>
<!ELEMENT =__slide= (=headline= | =text= | =example= | =TABLE= | =ulist= | =olist= | =dlist= | %standalonetag;)+>
<!ENTITY % standalonetag "=IMAGE= | =INDEX=">
<!ELEMENT =IMAGE= EMPTY>
<!ATTLIST =IMAGE=
	src CDATA #REQUIRED
>
<!ELEMENT =INDEX= (=indexgroup=+)>

lib/PerlPoint/Generator/XML/Default.pm  view on Meta::CPAN

 {
  # get and check parameters
  (my __PACKAGE__ $me)=@_;
  confess "[BUG] Missing object parameter.\n" unless $me;
  confess "[BUG] Object parameter is no ", __PACKAGE__, " object.\n" unless ref $me and $me->isa(__PACKAGE__);

  # don't forget the base class
  $me->SUPER::finish;

  # write document
  my ($handle, $presentationTag, $docdataTag, $slidesTag)=($me->{targethandle}, $me->elementName('__root'), $me->elementName('__docdata'), $me->elementName('__slides'));
  print $handle $me->{xml}->$presentationTag(
                                             # add meta data part
                                             $me->{xml}->$docdataTag(
                                                                     # the "doc..." options are reserved for this ...
                                                                     map
                                                                      {
                                                                       /^doc(.+)$/;
                                                                       my $tag=$me->elementName("_$1");
                                                                       $me->{xml}->$tag($me->{options}{$_}),
                                                                      } sort grep(/^doc/, keys %{$me->{options}}),
                                                                    ),

                                             # embed slides into a special section



( run in 0.597 second using v1.01-cache-2.11-cpan-454fe037f31 )