Result:
found 674 distributions and 1899 files matching your query ! ( run in 0.599 )


XML-All

 view release on metacpan or  search on metacpan

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

};

my $unwrap = sub {
    $twig{$id->($_[0]) || do {
        my $elt = XML::Twig::Elt->new(XML::Twig::PCDATA);
        $elt->_set_pcdata($_[0]);
        return $elt;
    }};
};

sub xml {

 view all matches for this distribution


XML-Atom-SimpleFeed

 view release on metacpan or  search on metacpan

lib/XML/Atom/SimpleFeed.pm  view on Meta::CPAN

sub xml_attr_escape {
	$_[0] =~ s{ ( [\x0A\x0D<>&'"] ) }{ $XML_ESC{ $1 } }gex;
	&xml_cref;
}

sub xml_cdata_flatten {
	for ( $_[0] ) {
		my $cdata_content;
		s{<!\[CDATA\[(.*?)]]>}{ xml_escape $cdata_content = $1 }gse;
		croak 'Incomplete CDATA section' if -1 < index $_, '<![CDATA[';
		return $_;
	}
}

sub xml_string { xml_cref xml_cdata_flatten $_[ 0 ] }

sub xml_tag {
	my $name = shift;
	my $attr = '';
	if( ref $name eq 'ARRAY' ) {

 view all matches for this distribution


XML-Atom-Stream

 view release on metacpan or  search on metacpan

lib/XML/Atom/Stream.pm  view on Meta::CPAN

my %Map = ('&' => '&amp;', '"' => '&quot;', '<' => '&lt;', '>' => '&gt;',
           '\'' => '&apos;');
my $RE = join '|', keys %Map;

sub encode_xml {
    my($str, $no_cdata) = @_;
    if (!$no_cdata && $str =~ m/
        <[^>]+>  ## HTML markup
        |        ## or
        &(?:(?!(\#([0-9]+)|\#x([0-9a-fA-F]+))).*?);
                 ## something that looks like an HTML entity.
        /x) {

 view all matches for this distribution


XML-Atom-Syndication

 view release on metacpan or  search on metacpan

lib/XML/Atom/Syndication/Text.pm  view on Meta::CPAN

                      if (@children == 1 && $local eq 'div');

                    # $text->{__body} = '<div>';
                    my $w = XML::Atom::Syndication::Writer->new;
                    $w->set_prefix('', 'http://www.w3.org/1999/xhtml');
                    $w->no_cdata(1);  # works nicer with fringe case. see tests.
                    map { $text->{__body} .= $w->as_xml($_) } @children;

                    # $text->{__body} .= '</div>';
                } else {
                    $text->{__body} = $elem->text_content;

 view all matches for this distribution


XML-AutoWriter

 view release on metacpan or  search on metacpan

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

   my XML::Doctype::ElementDecl $root_elt = $elts->{$root} ;
   # print STDERR "searching for $root ... $dest\n" ;

   return []
      if $root_elt->is_any
         || ( $dest eq '#PCDATA' && $root_elt->can_contain_pcdata ) ;

   my $paths = $root_elt->{PATHS} ;
   unless ( $paths ) {
      ## Init the cache
      $paths = $root_elt->{PATHS} = {

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

      # print STDERR "doing $gkid\n" ;
      push @$todo, $elts->{$gkid}->child_names ;

      my $gkid_path = $paths->{$gkid} ;

      if ( $elts->{$gkid}->can_contain_pcdata() ) {
	 $paths->{'#PCDATA'} = [ @$gkid_path, $gkid ]
	    unless exists $paths->{'#PCDATA'} ;
	 # print STDERR "checking (pcdata) ",
	 # join( '', map "<$_>", @{$paths->{'#PCDATA'}} ), "\n" ;
	 if ( $dest eq '#PCDATA' ) {
	    # print STDERR "Yahoo!\n" ;
	    return $paths->{'#PCDATA'} ;
	 }

 view all matches for this distribution


XML-Axk

 view release on metacpan or  search on metacpan

lib/XML/Axk/SAX/BuildDOM2.pm  view on Meta::CPAN

    $self->{Element}->appendChild (
                            $self->{Document}->createEntityReference ($name));
    undef $self->{LastText};
} #entity_reference()

sub start_cdata
{
    my $self = shift;
    $self->{InCDATA} = 1;
} #start_cdata()

sub end_cdata
{
    my $self = shift;
    $self->{InCDATA} = 0;
} #end_cdata()

sub comment
{
    my $self = $_[0];

 view all matches for this distribution


XML-Bare-SAX-Parser

 view release on metacpan or  search on metacpan

parser_engine.c  view on Meta::CPAN

                    *(cpos+4) == 'D' &&
                    *(cpos+5) == 'A' &&
                    *(cpos+6) == 'T' &&
                    *(cpos+7) == 'A'    ) {
                  cpos += 9;
                  goto cdata;
                }
                else {
                  cpos++; cpos++;
                  goto val_x;//actually goto error...
                }

parser_engine.c  view on Meta::CPAN

        goto val_1;
      }
      cpos++;
      goto bang;
    
    cdata:
      let = *cpos;
      if( !let ) goto done;
      if( let == ']' && *(cpos+1) == ']' && *(cpos+2) == '>' ) {
        cpos += 3;
        goto val_1;

parser_engine.c  view on Meta::CPAN

        curnode->vallen = 0;
        curnode->numvals = 1;
      }
      if( curnode->numvals == 1 ) curnode->vallen++;
      cpos++;
      goto cdata;
      
    name_1:
      let = *cpos;
      if( !let ) goto done;
      switch( let ) {

 view all matches for this distribution


XML-Bare

 view release on metacpan or  search on metacpan

Bare.pm  view on Meta::CPAN

    if( ref( $oba ) eq 'HASH' ) { $posa = $oba->{'_pos'} || 0; }
    if( ref( $obb ) eq 'HASH' ) { $posb = $obb->{'_pos'} || 0; }
    return $posa <=> $posb;
  } keys %$objs;
  
  if( $objs->{'_cdata'} ) {
    my $val = $objs->{'value'};
    $val =~ s/^(\s*\n)+//;
    $val =~ s/\s+$//;
    $val =~ s/&/&amp;/g;
    $val =~ s/</&lt;/g;
    $objs->{'value'} = $val;
    #$xml = "$less![CDATA[<div class='node'><div class='cdata'>$val</div></div>]]$more";
    $cd0 = "$less![CDATA[<div class='node'><div class='cdata'>";
    $cd1 = "</div></div>]]$more";
  }
  for my $i ( @dex ) {
    my $obj  = $objs->{ $i } || '';
    my $type = ref( $obj );

Bare.pm  view on Meta::CPAN

    }
    else {
      if( $i eq 'comment' ) { $xml .= "$less!--" . $obj . "--$more" . "<br>\n"; }
      elsif( $i eq 'value' ) {
        if( $level > 1 ) {
          if( $obj && $obj =~ /[<>&;]/ && ! $objs->{'_cdata'} ) { $xml .= "$less![CDATA[$obj]]$more"; }
          else { $xml .= $obj if( $obj =~ /\S/ ); }
        }
      }
      elsif( $i =~ /^_/ ) {}
      else { $xml .= "$less$tn0$i$tn1$more$obj$less/$tn0$i$tn1$more"; }

 view all matches for this distribution



XML-Checker

 view release on metacpan or  search on metacpan

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

	$self->Char ($data);
    }
}

# PerlSAX API
sub start_cdata
{
    $_[0]->{InCDATA} = 1;
}

# PerlSAX API
sub end_cdata
{
    $_[0]->{InCDATA} = 0;
}

sub Char

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

}

# Treat CDATASection same as Char (Text)
sub CData
{
    my ($self, $cdata) = @_;
    my $context = $self->{Context};

    $context->[0]->Char ($self, $cdata);

    # CDATASection can never be insignificant whitespace
    $INSIGNIF_WS = 0;
#?? I'm not sure if this assumption is correct
}

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

XML::Checker now also supports the PerlSAX interface, so you can use XML::Checker
wherever you use PerlSAX handlers.

XML::Checker implements the following methods: start_document, end_document,
start_element, end_element, characters, processing_instruction, comment,
start_cdata, end_cdata, entity_reference, notation_decl, unparsed_entity_decl,
entity_decl, element_decl, attlist_decl, doctype_decl, xml_decl

Not implemented: set_document_locator, ignorable_whitespace

See PerlSAX.pod for details. (It is called lib/PerlSAX.pod in the libxml-perl 

 view all matches for this distribution


XML-Comma

 view release on metacpan or  search on metacpan

lib/XML/Comma/Element.pm  view on Meta::CPAN


##
# object fields
#
# _content             : string holding element content
# _cdata               : mark this element as needing to be wrapped in
#                        a CDATA container. currently, any element that
#                        has a CDATA start tag anywhere immediately inside it
#                        will be marked this way

# no need for an init sub here (parent's does the work of initting the

lib/XML/Comma/Element.pm  view on Meta::CPAN

##

##
# called by parser and part of public api
#
# mark this element as needing a cdata wrapper
sub cdata_wrap {
  $_[0]->assert_not_read_only();
  $_[0]->{_cdata} = 1;
}
#
##


lib/XML/Comma/Element.pm  view on Meta::CPAN


# all callees (validate_content_hooks) should die with a message
# string if they encounter an error
sub validate_content {
  my ( $self, $text ) = @_;
  if ( $_[0]->{_cdata} ) {
    $text = "<![CDATA[$text]]>";
  }
  # check for un-parseable content by trying to parse and catching
  # errors. then ask the def to call any of its validate_hooks
  eval {

lib/XML/Comma/Element.pm  view on Meta::CPAN

  # don't output if empty
  return ''  unless defined $content and
                            $content ne '';
  my $str;
  $str = '<' . $self->tag() . $self->attr_string() . '>';
  $str .= '<![CDATA['  if  $self->{_cdata};
  $str .= $content;
  $str .= ']]>'  if $self->{_cdata};
  $str .= '</'. $self->tag() . '>';
  $str .= "\n";
  return $str;
}

 view all matches for this distribution


XML-CompactTree-XS

 view release on metacpan or  search on metacpan

XS.pm  view on Meta::CPAN

Planned flags:

   XCT_USE_QNAMES - use QNames instead of local names for all nodes
   XCT_TEXT_AS_STRING - put text nodes into the tree as plain scalars
   XCT_PRESERVE_PARENT - add a slot with a weak reference to the parent node
   XCT_MERGE_TEXT_NODES - merge adjacent text/cdata nodes together

Features: allow blessing the array refs to default or user-specified
classes; the default classes would provide a very small subset of DOM
methods to retrieve node information, manipulate the tree, and
possibly serialize the parse tree back to XML.

 view all matches for this distribution


XML-CompactTree

 view release on metacpan or  search on metacpan

CompactTree.pm  view on Meta::CPAN

Planned flags:

   XCT_USE_QNAMES - use QNames instead of local names for all nodes
   XCT_TEXT_AS_STRING - put text nodes into the tree as plain scalars
   XCT_PRESERVE_PARENT - add a slot with a weak reference to the parent node
   XCT_MERGE_TEXT_NODES - merge adjacent text/cdata nodes together

Features: allow blessing the array refs to default or user-specified
classes; the default classes would provide a very small subset of DOM
methods to retrieve node information, manipulate the tree, and
possibly serialize the parse tree back to XML.

 view all matches for this distribution


XML-Compare

 view release on metacpan or  search on metacpan

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

	grep { (not $_->isa('XML::LibXML::Comment')) and
		   not ( $_->isa("XML::LibXML::Text") && ($_->data =~ /\A\s*\Z/) )
	       } $node2->childNodes();

    # firstly, convert all CData nodes to Text Nodes
    @nodes1 = _convert_cdata_to_text( @nodes1 );
    @nodes2 = _convert_cdata_to_text( @nodes2 );

    # append all the consecutive Text nodes
    @nodes1 = _squash_text_nodes( @nodes1 );
    @nodes2 = _squash_text_nodes( @nodes2 );

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

    _msg($l, '/');
    return 1;
}

# takes an array of nodes and converts all the CDATASection nodes into Text nodes
sub _convert_cdata_to_text {
    my @nodes = @_;
    my @new;
    foreach my $n ( @nodes ) {
	if ( ref $n eq 'XML::LibXML::CDATASection' ) {
	    $n = XML::LibXML::Text->new( $n->data() );

 view all matches for this distribution


XML-Compile

 view release on metacpan or  search on metacpan

lib/XML/Compile/FAQ.pod  view on Meta::CPAN


To get CDATA blocks, the solution is very close to the example in the
previous section:

   my $doc   = XML::LibXML::Document->new('1.1', 'UTF-8');
   my $cdata = $doc->createCDATASection($content);
   my $xml   = $schema->writer($type)->($doc, { field => $cdata });
   $doc->setDocumentElement($xml);

The "$content" is a Perl string, which means that it needs to be
utf8 when it is utf8.  For instance:

   use File::Slurp::Tiny;
   my $content = read_file $filename, binmode => 'utf8';
   my $cdata   = $doc->createCDATASection($content);

When using SOAP (with or without WSDL) you need to do something like
this:

   use XML::LibXML;   # for ::Document

 view all matches for this distribution


XML-Crawler

 view release on metacpan or  search on metacpan

t/XML-Crawler.t  view on Meta::CPAN

                                    'type'  => 'text/css'
                                },
                                [ '
/*',
                                    [
                                        '#cdata-section',
                                        '*/
@import url("/2008/site/css/advanced");
/*'
                                    ],
                                    '*/

t/XML-Crawler.t  view on Meta::CPAN

                                            'type' => 'text/javascript'
                                        },
                                        [ '
//',
                                            [
                                                '#cdata-section',
                                                '
<!-- -->
//'
                                            ] ] ] ] ] ] ] ] ] ] );

 view all matches for this distribution


XML-DOM-Lite

 view release on metacpan or  search on metacpan

lib/XML/DOM/Lite.pm  view on Meta::CPAN

     }
 }

... or ...

 @cdata = map {
     $_->nodeValue if $_->nodeType == TEXT_NODE
 }, @{$node->childNodes};

... or for attributes :

 view all matches for this distribution


XML-DOM

 view release on metacpan or  search on metacpan

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


use XML::DOM::DOMException;

sub getNodeName
{
    "#cdata-section";
}

sub getNodeType
{
    CDATA_SECTION_NODE;

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

}

sub _to_sax
{
    my ($self, $doch, $dtdh, $enth) = @_;
    $doch->start_cdata;
    $doch->characters ( { Data => $self->getData } );
    $doch->end_cdata;
}

######################################################################
package XML::DOM::Comment;
######################################################################

 view all matches for this distribution


XML-DOM2

 view release on metacpan or  search on metacpan

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


	foreach my $name (keys(%{$hash})) {
		my $data  = $hash->{$name};

		if($name eq '+') {
			$element->cdata($data)
		} elsif($name =~ /^_(.+)$/) {
			$element->setAttribute($1, $data);
		} else {
		  my $isa = UNIVERSAL::isa($data, 'ARRAY');
			my $child = $isa ? $name : $element->createElement( $name );

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

# Adapt a SCALAR into XML
sub _adapt_scalar
{
	my ($self, $element, $scalar) = @_;
	if(defined($scalar)) {
		my $result = $element->createElement( '#cdata-entity', text => scalar( $scalar ) );
	}
	return $element;
}

=head2 $object->extension()

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

	if($type eq '#document' or $type eq $self->_document_name) {
		$opts{'documentTag'} = $type if $type ne '#document';
		return XML::DOM2::Element::Document->new(%opts);
	} elsif($type eq '#comment') {
		return XML::DOM2::Element::Comment->new( delete($opts{'text'}), %opts);
	} elsif($type eq '#cdata-entity') {
		return XML::DOM2::Element::CDATA->new(delete($opts{'text'}), %opts);
	}
	return XML::DOM2::Element->new( $type, %opts );
}

 view all matches for this distribution


XML-DOMHandler

 view release on metacpan or  search on metacpan

DOMHandler.pm  view on Meta::CPAN

#
my %dispatch_table = (
		      &XML_ELEMENT_NODE        => '_handle_element',
		      &XML_ATTRIBUTE_NODE      => '_handle_attribute',
		      &XML_TEXT_NODE           => '_handle_text',
		      &XML_CDATA_SECTION_NODE  => '_handle_cdata',
		      &XML_ENTITY_REF_NODE     => '_handle_entity_ref',
		      &XML_ENTITY_NODE         => '',
		      &XML_PI_NODE             => '_handle_pi',
		      &XML_COMMENT_NODE        => '_handle_comment',
		      &XML_DOCUMENT_NODE       => '_handle_doc_node',

DOMHandler.pm  view on Meta::CPAN

sub _handle_text {
    my( $self, $node ) = @_;
    return $self->_apply_user_handler( $node, 'generic_text' );
}

sub _handle_cdata {
    my( $self, $node ) = @_;
    return $self->_apply_user_handler( $node, 'generic_CDATA' );
}

sub _handle_entity_ref {

 view all matches for this distribution


XML-DT

 view release on metacpan or  search on metacpan

examples/ex7.pl  view on Meta::CPAN

%handler=(
    '-outputenc' => 'ISO-8859-1',
#    '-default'   => sub{"<$q>$c</$q>"},
     '-begin'  => sub{print"BEGIN\n"},
     '-end'  => sub{print"end\n";"$beginLatex$c$endLatex"},
     '-pcdata' => sub{ 
         if(inctxt('(SECTION|SUBSEC1)')) {$c =~ s/[\s\n]+/ /g; $c }
         $c },
     'RANDLIST' => sub{"\\begin{itemize}$c\\end{itemize}"},
     'AFFIL' => sub{""},
     'TITLE' => sub{

examples/ex7.pl  view on Meta::CPAN

 my @aut=();

 %handler=(
     '-outputenc' => 'ISO-8859-1',
 #    '-default'   => sub{"<$q>$c</$q>"},
      '-pcdata' => sub{ 
 	 if(inctxt('(SECTION|SUBSEC1)')) {$c =~ s/[\s\n]+/ /g; $c }
 	 $c },
      'RANDLIST' => sub{"\\begin{itemize}$c\\end{itemize}"},
      'AFFIL' => sub{""},
      'TITLE' => sub{

 view all matches for this distribution


XML-DTD

 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


XML-Declare

 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


XML-Diff

 view release on metacpan or  search on metacpan

Diff.pm  view on Meta::CPAN

    $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


XML-DifferenceMarkup

 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


XML-DocStats

 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


XML-ED

 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


XML-Easy

 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


XML-Enc

 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


XML-ExtOn

 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


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