view release on metacpan or search on metacpan
lib/XML/DTD/AttDef.pm view on Meta::CPAN
my $xmlw = shift;
$xmlw->open('attdef', {'name' => $self->{'NAME'},
'ltws' => $self->{'WS0'}});
$xmlw->open('atttype', {'ltws' => $self->{'WS1'}});
$xmlw->pcdata($self->type);
$xmlw->close;
$xmlw->open('defaultdecl', {'ltws' => $self->{'WS2'}});
$xmlw->pcdata($self->default);
$xmlw->close;
$xmlw->close;
}
view all matches for this distribution
view release on metacpan or search on metacpan
ex/example.pl view on Meta::CPAN
for (1..3) {
element entry => sub {
element title => 'Title', type => 'text';
element content => sub {
attr type => 'text';
cdata 'Desc';
};
element published => '123123-1231-123-123';
element author => sub {
element name => 'Mons';
}
view all matches for this distribution
view release on metacpan or search on metacpan
$signature = 'TEXT';
$thumbprint = $signature.$node->textContent();
$weight = length($thumbprint);
} elsif( $nodeType == 4 ) {
#$self->_debug( "- cdata section -" );
# XML_CDATA_SECTION_NODE= 4,
# cdata section
$signature = 'CDATA';
$thumbprint = $signature.$node->textContent();
$weight = length($thumbprint);
} elsif( $nodeType == 7 ) {
view all matches for this distribution
view release on metacpan or search on metacpan
perl-libxml-sax.c view on Meta::CPAN
SAVETMPS;
PUSHMARK(SP) ;
XPUSHs(handler);
PUTBACK;
call_method( "start_cdata", G_SCALAR | G_EVAL | G_DISCARD );
if (SvTRUE(ERRSV)) {
croak_obj;
}
SPAGAIN;
perl-libxml-sax.c view on Meta::CPAN
PUSHMARK(SP) ;
XPUSHs(handler);
PUTBACK;
call_method( "end_cdata", G_SCALAR | G_EVAL | G_DISCARD );
sv_2mortal(rv);
if (SvTRUE(ERRSV)) {
croak_obj;
}
perl-libxml-sax.c view on Meta::CPAN
retval->characters = (charactersSAXFunc)&PSaxCharacters;
retval->ignorableWhitespace = (ignorableWhitespaceSAXFunc)&PSaxCharacters;
retval->comment = (commentSAXFunc)&PSaxComment;
retval->cdataBlock = (cdataBlockSAXFunc)&PSaxCDATABlock;
retval->processingInstruction = (processingInstructionSAXFunc)&PSaxProcessingInstruction;
/* warning functions should be internal */
retval->warning = (warningSAXFunc)&PmmSaxWarning;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/DocStats.pm view on Meta::CPAN
$self->printstat('ATTRIBUTES: ','',grep {m/^@/} @keys);
$self->printstat('ATTRVALUES: ',"'",grep {m/^\^/} @keys);
$self->printstat('ENTITIES: ','',grep {m/^&/} @keys);
}
sub start_cdata {
my ($self, $element) = @_;
$self->stats('!CDATA');
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/ED/Bare.xs view on Meta::CPAN
PERL_HASH(chash, "comment", 7);
PERL_HASH(phash, "_pos", 4);
PERL_HASH(ihash, "_i", 2 );
PERL_HASH(zhash, "_z", 2 );
PERL_HASH(nhash, "_n", 2 );
PERL_HASH(cdhash, "_cdata", 6 );
PERL_HASH(typehash, "_type", 5 );
parser = (struct parserc *) malloc( sizeof( struct parserc ) );
root = parserc_parse( parser, text );
SV *
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Easy/Syntax.pm view on Meta::CPAN
$xml10_char_rx $xml10_s_rx $xml10_eq_rx
$xml10_namestartchar_rx $xml10_namechar_rx
$xml10_name_rx $xml10_names_rx $xml10_nmtoken_rx $xml10_nmtokens_rx
$xml10_charref_rx $xml10_entityref_rx $xml10_reference_rx
$xml10_chardata_rx
$xml10_cdata_rx $xml10_cdstart_rx $xml10_cdend_rx $xml10_cdsect_rx
$xml10_attvalue_rx $xml10_attribute_rx
$xml10_stag_rx $xml10_etag_rx $xml10_emptyelemtag_rx
$xml10_comment_rx $xml10_pitarget_rx $xml10_pi_rx
$xml10_content_rx $xml10_element_rx
$xml10_versionnum_rx $xml10_versioninfo_rx
lib/XML/Easy/Syntax.pm view on Meta::CPAN
our $xml10_chardata_rx = qr/(?:
\]?(?![<&\]])$xml10_char_rx
|\]{2,}(?![<&\>\]])$xml10_char_rx
)*\]*/xo;
=item $xml10_cdata_rx
Literal character data in a CDATA section. This consists of zero or
more acceptable characters, not including "B<< ]]> >>" as a subsequence.
Unlike ordinary literal character data, the characters "B<< < >>" and
"B<&>" are not metacharacters here. Such data stands for itself when
lib/XML/Easy/Syntax.pm view on Meta::CPAN
Also, as with ordinary literal character data, two instances of this
production should not abut.
=cut
our $xml10_cdata_rx = qr/(?:
\]?(?!\])$xml10_char_rx
|\]{2,}(?![\>\]])$xml10_char_rx
)*\]*/xo;
=item $xml10_cdstart_rx
lib/XML/Easy/Syntax.pm view on Meta::CPAN
A CDATA section. This consists of "B<< <![CDATA[ >>", literal character
data with metacharacters disabled, and "B<< ]]> >>".
=cut
# Note: using the $xml10_cdata_rx regexp (from above) here would be much
# less efficient than this use of (?>...). It would also run into the
# perl bug described in L</BUGS>.
our $xml10_cdsect_rx = qr/(?><!\[CDATA\[$xml10_char_rx*?\]\]>)/o;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Enc.pm view on Meta::CPAN
my $xencns = 'http://www.w3.org/2001/04/xmlenc#';
my $dsigns = 'http://www.w3.org/2000/09/xmldsig#';
my $xenc11ns = 'http://www.w3.org/2009/xmlenc11#';
my $encdata = $self->_create_node($doc, $xencns, $doc, 'xenc:EncryptedData',
{
Type => 'http://www.w3.org/2001/04/xmlenc#Element',
}
);
$doc->setDocumentElement ($encdata);
my $encmethod = $self->_create_node(
$doc,
$xencns,
$encdata,
'xenc:EncryptionMethod',
{
Algorithm => $self->{data_enc_method},
}
);
my $keyinfo = $self->_create_node(
$doc,
$dsigns,
$encdata,
'dsig:KeyInfo',
);
my $enckey = $self->_create_node(
$doc,
lib/XML/Enc.pm view on Meta::CPAN
);
my $cipherdata = $self->_create_node(
$doc,
$xencns,
$encdata,
'xenc:CipherData',
);
my $ciphervalue = $self->_create_node(
$doc,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/ExtOn.pm view on Meta::CPAN
=item * on_end_element
=item * on_characters
=item * on_cdata
=back
XML::ExtOn put all B<cdata> characters into a single event C<on_cdata>.
It compliant XML namespaces (http://www.w3.org/TR/REC-xml-names/), by support
I<default namespace> and I<namespace scoping>.
XML::ExtOn provide methods for create XML, such as C<mk_element>, C<mk_cdata> ...
=head1 FUNCTIONS
=cut
lib/XML/ExtOn.pm view on Meta::CPAN
use base 'XML::SAX::Base';
use vars qw( $AUTOLOAD);
$XML::ExtOn::VERSION = '0.17';
### install get/set accessors for this object.
for my $key (
qw/ context _objects_stack _cdata_mode _cdata_characters _root_stack /)
{
no strict 'refs';
*{ __PACKAGE__ . "::$key" } = sub {
my $self = shift;
$self->{___EXT_on_attrs}->{$key} = $_[0] if @_;
lib/XML/ExtOn.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = &XML::SAX::Base::new( $class, @_, );
$self->_objects_stack( [] );
$self->_root_stack( [] ); #init incoming stack of start end
$self->_cdata_mode(0);
my $buf;
$self->_cdata_characters( \$buf ); #setup cdata buffer
my $doc_context = new XML::ExtOn::Context::;
$self->context($doc_context);
return $self;
}
lib/XML/ExtOn.pm view on Meta::CPAN
For example:
sub on_start_element {
my $self = shift;
my $elem = shift;
$elem->add_content( $self->mk_cdata("test"));
return $elem
}
...
return [ $elem, ,$self->mk_element("after_start_elem") ]
lib/XML/ExtOn.pm view on Meta::CPAN
sub on_characters {
my ( $self, $elem, $str ) = @_;
return $str;
}
=head2 on_cdata ( $current_element, $data )
Must return string for write to stream
sub on_cdata {
my ( $self, $elem, $str ) = @_;
return lc $str;
}
=cut
sub on_cdata {
my ( $self, $elem, $str ) = @_;
return $str;
}
#set flag for cdata content
sub start_cdata {
my $self = shift;
$self->_cdata_mode(1);
return;
}
#set flag to end cdata
sub end_cdata {
my $self = shift;
if ( my $elem = $self->current_element
and defined( my $cdata_buf = ${ $self->_cdata_characters } ) )
{
if ( defined( my $data = $self->on_cdata( $elem, $cdata_buf ) ) ) {
$self->SUPER::start_cdata;
$self->SUPER::characters( { Data => $data } );
$self->SUPER::end_cdata;
}
}
#after all clear cd_data_buffer and reset cd_data mode flag
my $new_buf;
$self->_cdata_characters( \$new_buf );
$self->_cdata_mode(0);
return;
}
sub characters {
my $self = shift;
lib/XML/ExtOn.pm view on Meta::CPAN
#skip characters without element
return;
}
#for cdata section collect characters in buffer
if ( $self->_cdata_mode ) {
# warn "$self do CDATA" . $data->{Data};
# warn " $self CDTATA" . Dumper( [ map { [ caller($_) ] } ( 0 .. 10 ) ] );
# unless defined $data;
${ $self->_cdata_characters } .= $data->{Data};
return;
}
#collect chars fo current element
if (
lib/XML/ExtOn.pm view on Meta::CPAN
}
);
return $parser;
}
=head2 mk_cdata $string | \$string
return command for insert cdata to stream
=cut
sub mk_cdata {
my $self = shift;
my $string = shift;
return { type => 'CDATA', data => ref($string) ? $string : \$string };
}
lib/XML/ExtOn.pm view on Meta::CPAN
}
elsif ( ref($comm) eq 'HASH' and exists $comm->{type} ) {
if ( $comm->{type} eq 'CDATA' ) {
#warn "$self : DO CDATA!!!";
$self->start_cdata;
$self->characters( { Data => ${ $comm->{data} } } );
$self->end_cdata;
}
elsif ( $comm->{type} eq 'CHARACTERS' ) {
unless ( ref( $comm->{data} ) eq 'SCALAR' ) {
warn "NOT REF" . Dumper $comm;
warn "empty" . Dumper( [ map { [ caller($_) ] } ( 0 .. 16 ) ] );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Fast.pm view on Meta::CPAN
order => 0, # not impl
attr => '-', # ok
text => '#text', # ok
join => '', # ok
trim => 1, # ok
cdata => undef, # ok + fallback -> text
comm => undef, # ok
@_
);
_xml2hash($xml,\%args);
}
lib/XML/Fast.pm view on Meta::CPAN
order => 0, # not impl
attr => '-', # ok
text => '#text', # ok
join => '', # ok
trim => 1, # ok
cdata => undef, # ok + fallback -> text
comm => undef, # ok
@_
);
_hash2xml($xml,\%args);
}
lib/XML/Fast.pm view on Meta::CPAN
=item trim [ = 1 ]
Trim leading and trailing whitespace from text nodes
=item cdata [ = undef ]
When defined, CDATA sections will be stored under this key
# cdata = undef
<node><![CDATA[ test ]]></node> => { node => 'test' }
# cdata = '#'
<node><![CDATA[ test ]]></node> => { node => { '#' => 'test' } }
=item comm [ = undef ]
When defined, comments sections will be stored under this key
view all matches for this distribution
view release on metacpan or search on metacpan
t/39_load_type.t
t/40_xml_deref.t
t/41_utf8_flag.t
t/42_indent.t
t/43_indent_atom.t
t/44_cdata.t
t/45_cdata_multi.t
t/46_atom_xhtml.t
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/FeedWriter.pm view on Meta::CPAN
You may specify as many channel elements as you wish.
Some minor elements may require hash/array references to specify extra attributes or child elements. Basically, a hash reference will be considered as child elements, and an array reference will be considered as a value of the elements plus a hash of...
XML::FeedWriter also accepts C<encoding> option ('utf-8' by default) and C<no_cdata> option, if you really care.
=head2 add_items
Adds items to the feed. Each item should be a hash reference, and characters are expected to be C<Encode::decode>d perl strings.
view all matches for this distribution
view release on metacpan or search on metacpan
BufferText.pm view on Meta::CPAN
### workaround for that problem.
sub start_document; sub end_document; sub start_element;
sub end_element; sub processing_instruction; sub comment;
sub skipped_entity; sub ignorable_whitespace; sub end_entity;
sub start_entity; sub entity_reference;
sub start_cdata; sub end_cdata;
1;
#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,#
#`,`, Documentation `,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,#
#```````````````````````````````````````````````````````````````````#
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Filter/Cache.pm view on Meta::CPAN
characters
processing_instruction
ignorable_whitespace
start_prefix_mapping
end_prefix_mapping
start_cdata
end_cdata
skipped_entity
notation_decl
unparsed_entity_decl
element_decl
attribute_decl
view all matches for this distribution
view release on metacpan or search on metacpan
my $self = shift;
# $self->SUPER::end_dtd(@_); # not implemented by Builder
$self->{Handler}->end_dtd(@_) if defined($self->{Handler});
}
sub start_cdata {
my $self = shift;
$self->SUPER::start_cdata(@_);
$self->{Handler}->start_cdata(@_) unless (!defined($self->{Handler}) ||
$self->{FULL_TREE});
}
sub end_cdata {
my $self = shift;
$self->SUPER::end_cdata(@_);
$self->{Handler}->end_cdata(@_) unless (!defined($self->{Handler}) ||
$self->{FULL_TREE});
}
sub start_entity {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Filter/DataIndenter.pm view on Meta::CPAN
my $event = shift @$content;
my $method = shift @$event;
next if $method eq "characters"
|| $method eq "start_cdata"
|| $method eq "end_cdata";
if ( $method eq "comment" || $method eq "processing_instruction") {
my $indent = $self->{Indent} x @{$self->{Stack}};
$self->SUPER::characters( { Data => "\n$indent" } );
}
view all matches for this distribution
view release on metacpan or search on metacpan
DetectWS.pm view on Meta::CPAN
}
$handlers{ws} = $handlers{characters};
#?? were should whitespace go?
# NOTE: 'cdata' is not a valid PerlSAX callback
if (UNIVERSAL::can ($handler, 'start_cdata') &&
UNIVERSAL::can ($handler, 'end_cdata'))
{
$handlers{cdata} = sub {
$handler->start_cdata;
$handler->characters (@_);
$handler->end_cdata;
}
}
else # pass CDATA as regular characters
{
$handlers{cdata} = $handlers{characters};
}
$self->{Callback} = \%handlers;
}
sub start_cdata
{
my ($self, $event) = @_;
$self->{InCDATA} = 1;
}
sub end_cdata
{
my ($self, $event) = @_;
$self->{InCDATA} = 0;
}
DetectWS.pm view on Meta::CPAN
{
my ($self, $event) = @_;
if ($self->{InCDATA})
{
# NOTE: 'cdata' is not a valid PerlSAX callback
$self->push_event ('cdata', $event);
my $parent = $self->{ParentStack}->[-1];
$parent->{State} |= ENDS_IN_NON_WS unless $parent->{State} == PRESERVE_WS;
return;
}
DetectWS.pm view on Meta::CPAN
XML::Filter::DetectWS also takes xml:space attributes into account. See below
for details.
CDATA sections are passed in the standard PerlSAX way (i.e. with surrounding
start_cdata and end_cdata events), unless the Handler does not implement these
methods. In that case, the CDATA section is simply passed to the characters
method.
=head1 Constructor Options
DetectWS.pm view on Meta::CPAN
Please send feedback!
The current implementation also detects whitespace after an element-start tag,
whitespace before an element-end tag.
It also detects whitespace before an element-start and after an element-end tag
and before or after comments, processing instruction, cdata sections etc.,
but this needs to be reimplemented.
In either case, the detected whitespace is split off into its own PerlSAX
characters event and an extra property 'Loc' is added. It can have 4 possible
values:
DetectWS.pm view on Meta::CPAN
=item * 2 (WS_END) - whitespace just before element-end tag
=item * 3 (WS_ONLY) - both WS_START and WS_END, i.e. it's the only text found between the start and end tag and it's all whitespace
=item * 0 (WS_INTER) - none of the above, probably before an element-start tag,
after an element-end tag, or before or after a comment, PI, cdata section etc.
=back
Note that WS_INTER may not be that useful, so this may change.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Filter/Dispatcher.pm view on Meta::CPAN
Also except where noted, axes have a principal event type of
C<start_element>. This node type is used by the C<*> node type test.
Note: XML::Filter::Dispatcher tries to die() on nonsensical paths like
C</a/start-document::*> or C<//start-cdata::*>, but it may miss some.
This is meant to help in debugging user code; the eventual goal is to
catch all such nonsense.
=over
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Generator/Essex.pm view on Meta::CPAN
For instance, you can pass any events you construct, so an Essex script
to make sure all character data is emitted in CDATA sections might look
like:
get( "text()" ), put cdata $_ while 1;
A less obvious feature is that you can pass a (possibly nested) Perl
ARRAY that defines an XML tree to emit:
put [
view all matches for this distribution
view release on metacpan or search on metacpan
ExceptionLocator.pm view on Meta::CPAN
BEGIN {
for my $method (qw(start_document end_document start_element
end_element processing_instruction comment
skipped_entity ignorable_whitespace end_entity
start_entity entity_reference
s tart_cdata end_cdata)) {
no strict 'refs';
my $super_meth = "SUPER::$method";
*{__PACKAGE__ . "::$method"} =
sub {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
t/02filter.t view on Meta::CPAN
ok(test05_complex_string());
sub test_iso_encoded_content {
my $encoding = "ISO-8859-1";
my $value = "bärföo";
my $cdata = "<foo/>bär<foo>föo</foo>";
my $handler = XML::LibXML::SAX::Builder->new();
my $filter = XML::Filter::CharacterChunk->new(
Encoding=> $encoding,
TagName => ["a"],
Handler => $handler
);
$filter->start_document();
$filter->start_element({Name=>"a", LocalName=>"a", Prefix=>""});
$filter->characters( {Data=>$cdata} );
$filter->end_element({Name=>"a", LocalName=>"a", Prefix=>""});
$dom = $filter->end_document();
unless ( defined $dom ) {
print "# parser error, filter did not create a document\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Filter/Glossary.pm view on Meta::CPAN
sub process_result {
my $self = shift;
my $result = shift;
my $cdata = undef;
my $markup = undef;
my $element = undef;
# Hack Until I figure where to tweak
# the REX expressions. Ick ick ick.
lib/XML/Filter/Glossary.pm view on Meta::CPAN
# print "PARSE [$1] [$2]\n";
if ($element) {
$markup .= $1;
} else {
$cdata .= $1;
}
if ($2) {
if ($cdata) {
$self->SUPER::characters({Data=>$cdata});
# print "CDATA '$cdata'\n";
$cdata = undef;
}
my $_markup = $2;
$markup .= $_markup;
lib/XML/Filter/Glossary.pm view on Meta::CPAN
}
}
if ($cdata) {
$self->SUPER::characters({Data=>$cdata});
}
if ($markup) {
print STDERR "WARNING\nThere was a bunch of unbalanced markup leftover: '$markup'\n";
$self->SUPER::characters({Data=>$markup});
view all matches for this distribution
view release on metacpan or search on metacpan
end_document => 1,
doctype_decl => 1,
processing_instruction => 1,
start_element => 1,
end_element => 1,
start_cdata => 1,
end_cdata => 1,
characters => 1
};
# ---------------------------------------------------------------------------- #
sub end_document { my ($self, $param) = @_; $self->style('end_document',$param); }
sub doctype_decl { my ($self, $param) = @_; $self->style('doctype_decl',$param); }
sub processing_instruction { my ($self, $param) = @_; $self->style('processing_instruction',$param); }
sub start_element { my ($self, $param) = @_; $self->style('start_element',$param); }
sub end_element { my ($self, $param) = @_; $self->style('end_element',$param); }
sub start_cdata { my ($self, $param) = @_; $self->style('start_cdata',$param); }
sub end_cdata { my ($self, $param) = @_; $self->style('end_cdata',$param); }
sub characters { my ($self, $param) = @_; $self->style('characters',$param); }
sub style {
my ($self,$event,$param) = @_;
my $target = "*";
$target = $param->{'Name'} if $param->{'Name'};
$target = $param->{'Target'} if $param->{'Target'};
$target = $self->{Stack}[0] if ( $event eq 'characters' or
$event eq 'start_cdata' or
$event eq 'end_cdata' ) and
$self->{Flag}{$self->{Stack}[0]};
my $action = $self->{'Action'}{$event.':'.$target};
return undef unless $action;
view all matches for this distribution
view release on metacpan or search on metacpan
Reindent.pm view on Meta::CPAN
sub push_event
{
my ($self, $type, $event) = @_;
$event->{EventType} = $type;
if ($type =~ /^(characters|comment|processing_instruction|entity_reference|cdata)$/)
{
my $indent_kids = $self->{ParentStack}->[-1]->{IndentChildren} ? 1 : 0;
$event->{Indent} = $indent_kids ? $self->{Level} : undef;
}
view all matches for this distribution
view release on metacpan or search on metacpan
"start_element",
"end_element",
"characters",
"processing_instruction",
"comment",
"start_cdata",
"end_cdata",
"entity_reference",
"set_document_locator" # !! passes {Locator=>$perlsax}
],
DTDHandler =>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Filter/XML_Directory_2XHTML.pm view on Meta::CPAN
$self->SUPER::end_element({Name=>DTD_HTML_ROOT});
$self->SUPER::end_document();
return 1;
}
sub start_cdata {}
sub end_cdata {}
sub start_dtd { }
sub end_dtd { }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/GDOME/XPath/Evaluator.pod
lib/XML/GDOME/XPath/Namespace.pod
lib/XML/GDOME/XPath/NSResolver.pod
lib/XML/GDOME/XPath/Result.pod
t/01_basic.t
t/02_cdata.t
t/03_document.t
t/04_dtd.t
t/05_element.t
t/06_namednodemap.t
t/07_node.t
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/GSA/Group.pm view on Meta::CPAN
if ( $record->{'mimetype'} eq 'text/plain' ) {
$self->writer->dataElement( 'content', $record->{'content'} );
}
elsif ( $record->{'mimetype'} eq 'text/html' ) {
$self->writer->cdataElement( 'content', $record->{'content'} );
}
#else {
#TODO support other mimetype with base64 encoding content
#}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Generator/RFC822/RDF.pm view on Meta::CPAN
$self->start_element({Name=>"rfc822:content-type"});
$self->characters({Data=>&_prepare_text($self->{'__parts'}->[0]->content_type())});
$self->end_element({Name=>"rfc822:content-type"});
$self->start_element({Name=>"rdf:value"});
$self->start_cdata();
# Oof - do I need to mime_decode all this too?
$self->characters({Data=>&_prepare_text($self->{'__parts'}->[0]->body_raw())});
$self->end_cdata();
$self->end_element({Name=>"rdf:value"});
$self->end_element({Name=>"rdf:Description"});
}
return 1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Generator.pm view on Meta::CPAN
If the value of this option is 'strict', a number of syntactic
checks are performed to ensure that generated XML conforms to the
formal XML specification. In addition, since entity names beginning
with 'xml' are reserved by the W3C, inclusion of this option enables
several special tag names: xmlpi, xmlcmnt, xmldecl, xmldtd, xmlcdata,
and xml to allow generation of processing instructions, comments, XML
declarations, DTD's, character data sections and "final" XML documents,
respectively.
Invalid characters (http://www.w3.org/TR/xml11/#charsets) will be filtered
lib/XML/Generator.pm view on Meta::CPAN
# return the appropriate <!DOCTYPE> thingy
$dtd ? return(qq{<!DOCTYPE } . (join ' ', @{$dtd}) . q{>})
: return('');
}
=head2 xmlcdata
Character data section; arguments are concatenated and placed inside
<![CDATA[ ... ]]> character data section delimiters. Any occurences of
']]>' in the concatenated arguments are converted to ']]>'.
=cut
sub xmlcdata {
my $this = shift;
$this->XML::Generator::util::tag('xmlcdata', @_)
unless $this->{conformance} eq 'strict';
my $xml = join '', @_;
# ]]> is not allowed; change it to ]]>
$xml =~ s/]]>/]]>/g;
XML::Generator::util::filter($xml);
$xml = "<![CDATA[$xml]]>";
return XML::Generator::cdata->new([$xml]);
}
=head2 xml
"Final" XML document. Must be called with one and exactly one
lib/XML/Generator.pm view on Meta::CPAN
if ($indent) {
my $prettyend = '';
foreach my $arg (@args) {
next unless defined $arg;
if ( UNIVERSAL::isa($arg, 'XML::Generator::cdata' ) ) {
my $copy = $xml;
push @xml, $copy, $arg;
$xml = '';
} else {
if ( UNIVERSAL::isa($arg, 'XML::Generator::overload') &&
! UNIVERSAL::isa($arg, 'XML::Generator::pi') ) {
$xml .= "\n$indent";
$prettyend = "\n";
XML::Generator::util::_fixupNS($namespace, $arg) if ref $arg->[0];
my @cdata;
for my $i (0..$#$arg) {
if (UNIVERSAL::isa($arg->[$i], 'XML::Generator::cdata')) {
push @cdata, $arg->[$i];
$arg->[$i] = "\001";
}
}
$arg =~ s/\n/\n$indent/gs;
if (@cdata) {
my @pieces = split "\001", $arg;
my $copy = $xml;
push @xml, $copy;
$xml = '';
$arg = '';
for my $i (0..$#pieces) {
if (defined $cdata[$i]) {
push @xml, $pieces[$i], $cdata[$i];
} else {
push @xml, $pieces[$i];
}
}
}
lib/XML/Generator.pm view on Meta::CPAN
push @xml, ($xml, "</$prefix$tag>");
} else {
@xml = $xml;
foreach my $arg (grep defined, @args) {
if ( UNIVERSAL::isa($arg, 'XML::Generator::overload') &&
(! ( UNIVERSAL::isa($arg, 'XML::Generator::cdata' ) ||
UNIVERSAL::isa($arg, 'XML::Generator::pi' )))) {
XML::Generator::util::_fixupNS($namespace, $arg) if ref $arg->[0];
}
push @xml, $arg;
}
lib/XML/Generator.pm view on Meta::CPAN
package XML::Generator::pi;
use base 'XML::Generator::overload';
package XML::Generator::cdata;
use base 'XML::Generator::overload';
1;
__END__
view all matches for this distribution