CAM-XML

 view release on metacpan or  search on metacpan

lib/CAM/XML.pm  view on Meta::CPAN

         {
            push @ret, $child->_to_string(
               %args, -level => defined $level ? $level+1 : undef,
            );
         }
         else
         {
            push @ret, $begin, $indent, $child->toString(), $end;
         }
      }
      push @ret, $begin, '</', $self->{name}, '>', $end;
   }

   return @ret;
}

# Private function
sub _XML_escape
{
   my $pkg_or_self = shift;
   my $text        = shift;

   if (!defined $text)
   {
      $text = q{};
   }
   $text =~ s/&/&amp;/gxms;
   $text =~ s/</&lt;/gxms;
   $text =~ s/>/&gt;/gxms;
   $text =~ s/\"/&quot;/gxms;
   return $text;
}

# Private function
sub _CDATA_escape
{
   my $pkg_or_self = shift;
   my $text        = shift;

   # Escape illegal "]]>" strings by ending and restarting the CDATA section
   $text =~ s/ ]]> /]]>]]&gt;<![CDATA[/gxms;

   return "<![CDATA[$text]]>";
}

1;
__END__

=back

=head1 ENCODING

It is assumed that all text will be UTF-8.  This includes any tag
names, attribute keys and values, text content, and raw XML content
that are added to the data structure.

=head1 CODING

This module has just over 97% code coverage in its regression tests,
as reported by Devel::Cover via C<perl Build testcover>.  The
remaining few percent is mostly error conditions and a few conditional
defaults on internal methods.

This module passes most of the Perl Best Practices guidelines, as
enforced by Perl::Critic v0.14.  A notable exceptions is the
legacy use of C<camelCase> subroutine names.

=head1 AUTHOR

Clotho Advanced Media Inc., I<cpan@clotho.com>

Primary Developer: Chris Dolan

=cut



( run in 1.877 second using v1.01-cache-2.11-cpan-39bf76dae61 )