Result:
found more than 682 distributions - search limited to the first 2001 files matching your query ( run in 1.900 )


XML-Parser-Style-EasyTree

 view release on metacpan or  search on metacpan

ex/test.pl  view on Meta::CPAN

			first
			<v>a</v>
			mid
			<!-- something commented -->
			<v at="a">b</v>
			<vv><![CDATA[ cdata <<>> content ]]></vv>
			last
		</nest>
	</root>},
);
print +Dumper $hash;

 view all matches for this distribution


XML-Parser-Wrapper

 view release on metacpan or  search on metacpan

lib/XML/Parser/Wrapper.pm  view on Meta::CPAN

=head3 pretty

If pretty is a true value, then whitespace is added to the output
to make it more human-readable.

=head3 cdata

If cdata is defined, any text nodes with length greater than
cdata are output as a CDATA section, unless it contains "]]>", in
which case the text is XML escaped.

Aliases: toXml()

=head3 decl

lib/XML/Parser/Wrapper.pm  view on Meta::CPAN

        }

        if ($self->is_text) {
            my $text = $self->text;

            if (defined $options->{cdata}) {
                if (length($text) >= $options->{cdata}) {
                    unless (index($text, ']]>') > -1) {
                        return '<![CDATA[' . $text . ']]>';
                    }
                }
            }

 view all matches for this distribution


XML-Parser-YahooRESTGeocode

 view release on metacpan or  search on metacpan

YahooRESTGeocode.pm  view on Meta::CPAN

    reverse (@data);
    return (\@data);
}


## extract_pcdata #################################
sub extract_pcdata {
    my $data = shift();
    my %out = ();
    foreach (@{$data}){
        foreach my $f (@_){
            if (($_->{'_name'} eq $f) && ($_->{'_data'} !~/^$/)){

YahooRESTGeocode.pm  view on Meta::CPAN

sub End { 
	my ($expat, $element) = @_;
	
	if (exists($node_tree{$element})){
	
		my $data = extract_pcdata(gather_data($expat, $element), @{$node_tree{$element}});
		push (@{$expat->{'Lists'}->{'DATA'}->{$element}}, $data);
		
		#if the user defined some callback to execute, do that
		if (exists($expat->{'_YahooREST_callbacks'}->{$element})){
			&{$expat->{'_YahooREST_callbacks'}->{$element}}($data);

 view all matches for this distribution


XML-PugiXML

 view release on metacpan or  search on metacpan

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


=item insert_copy_before($source, $ref), insert_copy_after($source, $ref)

Clone and insert node before/after reference.

=item append_cdata($content)

Add a CDATA section with the given content.

=item append_comment($content)

 view all matches for this distribution


XML-Quick

 view release on metacpan or  search on metacpan

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


use base qw(Exporter);

our @EXPORT = qw(xml);

# cdata escaping
sub _escape($) {
    my ($cdata) = @_;

    $cdata =~ s/&/&amp;/g;
    $cdata =~ s/</&lt;/g;
    $cdata =~ s/>/&gt;/g;
    $cdata =~ s/"/&quot;/g;

    $cdata =~ s/([^\x20-\x7E])/'&#' . ord($1) . ';'/ge;

    return $cdata;
};

sub xml {
    my ($data, $opts) = @_;

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

        $xml = $opts->{escape} ? _escape($data) : $data;
    }

    # dig down into hashes
    else {
        # move attrs/cdata into opts as necessary
        if(exists $data->{_attrs}) {
            $opts->{attrs} = $data->{_attrs} if not exists $opts->{attrs};
        }

        if(exists $data->{_cdata}) {
            $opts->{cdata} = $data->{_cdata} if not exists $opts->{cdata};
        }
        
        # loop over the keys
        for my $key (keys %{$data}) {
            # skip meta

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


            # hash
            elsif(reftype $data->{$key} eq 'HASH') {
                $xml .= xml($data->{$key}, { root => $key,
                                             attrs => $data->{$key}->{_attrs} || {},
                                             cdata => $data->{$key}->{_cdata} || '' })
            }

            # array
            elsif(reftype $data->{$key} eq 'ARRAY') {
                $xml .= xml($_, { root => $key }) for @{$data->{$key}};

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

                $wrap .= " $key='$val'";
            }
        }

        # character data
        if($opts->{cdata}) {
            $xml = ($opts->{escape} ? _escape($opts->{cdata}) : $opts->{cdata}) . $xml;
        }

        # if there's no content, then close it up right now
        if($xml eq '') {
            $wrap .= '/>';

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

        });

    # produces: <tag foo='bar'/>
 
Of course, you're probably going to want to include a value or other tags
inside this tag. For a value, use the C<_cdata> key:

    xml({
          'tag' => {
                     '_attrs' => {
                                   'foo' => 'bar'
                                 },
                     '_cdata' => 'value'
                   }
        });

    # produces: <tag foo='bar'>value</tag>

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

Used in conjuction with the C<root> option to add attributes to the root tag.

    xml({ tag => 'value' }, { root => 'wrap', attrs => { style => 'shiny' }});
    # produces: <wrap style='shiny'><tag>value</tag></wrap>

=item * cdata

Used in conjunction with the C<root> option to add character data to the root
tag.

    xml({ tag => 'value' }, { root => 'wrap', cdata => 'just along for the ride' });
    # produces: <wrap>just along for the ride<tag>value</tag></wrap>

You probably don't need to use this. If you just want to create a basic tag
from nothing do this:

    xml({ tag => 'value' });

Rather than this:

    xml('', { root => 'tag', cdata => 'value' });

You almost certainly don't want to add character data to a root tag with nested
tags inside. See L<BUGS AND LIMITATIONS> for more details.

=item * escape

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

the hash.  This generally won't be a problem as the vast majority of XML-based
datatypes don't care about order. I don't recommend you use this module to
create XML when order is important (eg XHTML, XSL, etc).

Things are even more hairy when including character data alongside tags via the
C<cdata> or C<_cdata> options. The C<cdata> options only really exist to allow
attributes and values to be specified for a single tag. The rich support
necessary to support multiple character data sections interspersed alongside
tags is entirely outside the scope of what the module is designed for.

There are probably bugs. This kind of thing is an inexact science. Feedback

 view all matches for this distribution


XML-RSS-Parser

 view release on metacpan or  search on metacpan

lib/XML/RSS/Parser/Util.pm  view on Meta::CPAN

           '\'' => '&#39;'
);
my $RE = join '|', keys %Map;

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

lib/XML/RSS/Parser/Util.pm  view on Meta::CPAN

will add an XML 1.0 standard declaration to the returned
XML. The third parameter (also optional) parameter defines
the encoding to be used in the declaration. The default is
'utf-8'.

=item encode_xml ($string[, $nocdata])

XML encodes any characters in the string that are required
to be represented as entities. This method will attempt to
identify anything that looks like markup and CDATA encodes
it. This can optional be turned off by passing a second

 view all matches for this distribution


XML-RSS

 view release on metacpan or  search on metacpan

keep-out/rejects/append.pl  view on Meta::CPAN

# and has been completely unused. Our guess was that it introduced to later
# serve in refactoring the module and was never used. It was not moved to
# this file, to possibly be used for future reference.

sub append {
	my($self, $inside, $cdata) = @_;

	my $ns = $self->namespace($self->current_element);

	# If it's in the default RSS 1.0 namespace
	if ($ns eq 'http://purl.org/rss/1.0/') {
		#$self->{'items'}->[$self->{num_items}-1]->{$self->current_element} .= $cdata;
		$inside->{$self->current_element} .= $cdata;
	}

	# If it's in another namespace
	#$self->{'items'}->[$self->{num_items}-1]->{$ns}->{$self->current_element} .= $cdata;
	$inside->{$ns}->{$self->current_element} .= $cdata;

	# If it's in a module namespace, provide a friendlier prefix duplicate
	$self->{modules}->{$ns} and $inside->{$self->{modules}->{$ns}}->{$self->current_element} .= $cdata;

	return $inside;
}

 view all matches for this distribution


XML-Registry

 view release on metacpan or  search on metacpan

Registry.pm  view on Meta::CPAN

		print " $attrib=".'"'.$attribs->{$attrib}.'"'
	    }
	    # print closing bracket
	    if (scalar(@$tree) > 2) {
		print ">";
	    # no cdata for this element
	    } else {
		print "/>";
	    }

        # print cdata
	} elsif ($tree->[$i] eq 0) {
	    print $tree->[++$i];	    
	}
    }
    

 view all matches for this distribution


XML-SAX-Base

 view release on metacpan or  search on metacpan

BuildSAXBase.pl  view on Meta::CPAN

                        ignorable_whitespace    => [qw(ContentHandler DocumentHandler Handler)],
                        set_document_locator    => [qw(ContentHandler DocumentHandler Handler)],
                        start_prefix_mapping    => [qw(ContentHandler Handler)],
                        end_prefix_mapping      => [qw(ContentHandler Handler)],
                        skipped_entity          => [qw(ContentHandler Handler)],
                        start_cdata             => [qw(DocumentHandler LexicalHandler Handler)],
                        end_cdata               => [qw(DocumentHandler LexicalHandler Handler)],
                        comment                 => [qw(DocumentHandler LexicalHandler Handler)],
                        entity_reference        => [qw(DocumentHandler Handler)],
                        notation_decl           => [qw(DTDHandler Handler)],
                        unparsed_entity_decl    => [qw(DTDHandler Handler)],
                        element_decl            => [qw(DeclHandler Handler)],

BuildSAXBase.pl  view on Meta::CPAN


=item * end_prefix_mapping

=item * skipped_entity

=item * start_cdata

=item * end_cdata

=item * comment

=item * entity_reference

 view all matches for this distribution


XML-SAX-Builder

 view release on metacpan or  search on metacpan

lib/XML/SAX/Builder.pm  view on Meta::CPAN

    my $self = shift;
    XML::SAX::Builder::Namespace->new( $self->{ Handler }, @_ );
}

# Output unescaped stuff.
sub xmlcdata {
    my $self = shift;
    XML::SAX::Builder::CDATA->new( $self->{ Handler }, @_ );
}

# Output an XML DOCTYPE

lib/XML/SAX/Builder.pm  view on Meta::CPAN

    Carp::croak "arguments must be character data only"
        if grep { ref } @args;
    @args = grep { defined } @args;
    return sub {
        my ( $self, $nsup ) = @_;
        $handler->start_cdata( {} );
        $handler->characters( { Data => join ( '', @args ) } );
        $handler->end_cdata( {} );
    };
}

#---------------------------------------------------------------------

lib/XML/SAX/Builder.pm  view on Meta::CPAN


This method inserts a new namespace into the resulting XML.  PREFIX and
URI are the namespace prefix and uri.  CHILD is either an element
object, or another namespace object.

=item xmlcdata ( TEXT, [ TEXT ] )

Inserts all arguments concatenated together inside a E<lt>![CDATA block.

=item xmldtd ( ELEMENT, SYSTEM [, PUBLIC ] )

 view all matches for this distribution


XML-SAX-Expat

 view release on metacpan or  search on metacpan

Expat.pm  view on Meta::CPAN

                        Start       => \&_handle_start,
                        End         => \&_handle_end,
                        Char        => \&_handle_char,
                        Comment     => \&_handle_comment,
                        Proc        => \&_handle_proc,
                        CdataStart  => \&_handle_start_cdata,
                        CdataEnd    => \&_handle_end_cdata,
                        Unparsed    => \&_handle_unparsed_entity,
                        Notation    => \&_handle_notation_decl,
                        #ExternEnt
                        #ExternEntFin
                        Entity      => \&_handle_entity_decl,

Expat.pm  view on Meta::CPAN

    $_[0]->{__XSE}->SUPER::processing_instruction({ Target => $_[1], Data => $_[2] });
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# _handle_start_cdata
#-------------------------------------------------------------------#
sub _handle_start_cdata {
    $_[0]->{__XSE}->SUPER::start_cdata( {} );
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# _handle_end_cdata
#-------------------------------------------------------------------#
sub _handle_end_cdata {
    $_[0]->{__XSE}->SUPER::end_cdata( {} );
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# _handle_xml_decl

 view all matches for this distribution


XML-SAX-ExpatXS

 view release on metacpan or  search on metacpan

ExpatXS.xs  view on Meta::CPAN

    SAVETMPS;

    PUSHMARK(sp);
    XPUSHs(cbv->self_sv);
    PUTBACK;
    perl_call_method("start_cdata", G_DISCARD);

    FREETMPS;
    LEAVE;
}  /* End startCdata */

ExpatXS.xs  view on Meta::CPAN

    SAVETMPS;

    PUSHMARK(sp);
    XPUSHs(cbv->self_sv);
    PUTBACK;
    perl_call_method("end_cdata", G_DISCARD);

    FREETMPS;
    LEAVE;
}  /* End endCdata */

 view all matches for this distribution


XML-SAX-Machines

 view release on metacpan or  search on metacpan

lib/XML/SAX/EventMethodMaker.pm  view on Meta::CPAN

    internal_entity_decl      Han;----;----;----;----;Dec
    external_entity_decl      Han;----;----;----;----;Dec
    comment                   Han;----;----;----;Lex
    start_dtd                 Han;----;----;----;Lex
    end_dtd                   Han;----;----;----;Lex
    start_cdata               Han;----;----;----;Lex
    end_cdata                 Han;----;----;----;Lex
    start_entity              Han;----;----;----;Lex
    end_entity                Han;----;----;----;Lex
    warning                   Han;----;----;----;----;----;Err
    error                     Han;----;----;----;----;----;Err
    fatal_error               Han;----;----;----;----;----;Err

 view all matches for this distribution


XML-SAX-Simple

 view release on metacpan or  search on metacpan

t/1_XMLin.t  view on Meta::CPAN

ok(24, DataCompare($opt, $target));


# confirm that CDATA sections parse correctly

$xml = q{<opt><cdata><![CDATA[<greeting>Hello, world!</greeting>]]></cdata></opt>};
$opt = XMLin($xml);
ok(25, DataCompare($opt, {
  'cdata' => '<greeting>Hello, world!</greeting>'
}));

$xml = q{<opt><x><![CDATA[<y>one</y>]]><![CDATA[<y>two</y>]]></x></opt>};
$opt = XMLin($xml);
ok(26, DataCompare($opt, {

 view all matches for this distribution


XML-SAX-SimpleDispatcher

 view release on metacpan or  search on metacpan

inc/XML/SAX/Base.pm  view on Meta::CPAN

        }
    }

}

sub end_cdata {
    my $self = shift;
    if (defined $self->{Methods}->{'end_cdata'}) {
        $self->{Methods}->{'end_cdata'}->(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self->{ParseOptions}) {

inc/XML/SAX/Base.pm  view on Meta::CPAN

        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('end_cdata') ) {
            my $handler = $callbacks->{'DocumentHandler'};
            $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) };
            return $method->($handler, @_);
        }
        elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('end_cdata') ) {
            my $handler = $callbacks->{'LexicalHandler'};
            $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) };
            return $method->($handler, @_);
        }
        elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_cdata') ) {
            my $handler = $callbacks->{'Handler'};
            $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) };
            return $method->($handler, @_);
        }
        elsif (defined $callbacks->{'DocumentHandler'} 
        	and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
        	and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks->{'DocumentHandler'}->end_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks->{'DocumentHandler'};
                $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks->{'LexicalHandler'} 
        	and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
        	and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks->{'LexicalHandler'}->end_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks->{'LexicalHandler'};
                $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks->{'Handler'} 
        	and $callbacks->{'Handler'}->can('AUTOLOAD')
        	and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks->{'Handler'}->end_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks->{'Handler'};
                $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) };
            }
            return $res;
        }
        else {
            $self->{Methods}->{'end_cdata'} = sub { };
        }
    }

}

inc/XML/SAX/Base.pm  view on Meta::CPAN

        }
    }

}

sub start_cdata {
    my $self = shift;
    if (defined $self->{Methods}->{'start_cdata'}) {
        $self->{Methods}->{'start_cdata'}->(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self->{ParseOptions}) {

inc/XML/SAX/Base.pm  view on Meta::CPAN

        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('start_cdata') ) {
            my $handler = $callbacks->{'DocumentHandler'};
            $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) };
            return $method->($handler, @_);
        }
        elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('start_cdata') ) {
            my $handler = $callbacks->{'LexicalHandler'};
            $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) };
            return $method->($handler, @_);
        }
        elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_cdata') ) {
            my $handler = $callbacks->{'Handler'};
            $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) };
            return $method->($handler, @_);
        }
        elsif (defined $callbacks->{'DocumentHandler'} 
        	and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
        	and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks->{'DocumentHandler'}->start_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks->{'DocumentHandler'};
                $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks->{'LexicalHandler'} 
        	and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
        	and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks->{'LexicalHandler'}->start_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks->{'LexicalHandler'};
                $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks->{'Handler'} 
        	and $callbacks->{'Handler'}->can('AUTOLOAD')
        	and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks->{'Handler'}->start_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks->{'Handler'};
                $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) };
            }
            return $res;
        }
        else {
            $self->{Methods}->{'start_cdata'} = sub { };
        }
    }

}

 view all matches for this distribution


XML-SAX-Writer

 view release on metacpan or  search on metacpan

lib/XML/SAX/Writer/XML.pm  view on Meta::CPAN

    $self->{BufferDTD} = '';
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# start_cdata
#-------------------------------------------------------------------#
sub start_cdata {
    my $self = shift;
    $self->_output_element;

    $self->{InCDATA} = 1;
    my $cds = $self->{Encoder}->convert('<![CDATA[');
    $self->{Consumer}->output($cds);
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# end_cdata
#-------------------------------------------------------------------#
sub end_cdata {
    my $self = shift;

    $self->{InCDATA} = 0;
    my $cds = $self->{Encoder}->convert(']]>');
    $self->{Consumer}->output($cds);

 view all matches for this distribution


XML-SAX

 view release on metacpan or  search on metacpan

lib/XML/SAX/PurePerl.pm  view on Meta::CPAN

    
    my $data = $reader->data(9);
    return 0 unless $data =~ /^<!\[CDATA\[/;
    $reader->move_along(9);
    
    $self->start_cdata({});
    
    $data = $reader->data;
    while (1) {
        $self->parser_error("EOF looking for CDATA section end", $reader)
            unless length($data);

lib/XML/SAX/PurePerl.pm  view on Meta::CPAN

            $self->characters({Data => $data});
            $reader->move_along(length($data));
            $data = $reader->data;
        }
    }
    $self->end_cdata({});
    return 1;
}

sub CharData {
    my ($self, $reader) = @_;

lib/XML/SAX/PurePerl.pm  view on Meta::CPAN

        $self->skip_whitespace($reader);
        $reader->match('=') or $self->parser_error("No '=' in Attribute", $reader);
        $self->skip_whitespace($reader);
        my $value = $self->AttValue($reader);

        if (!$self->cdata_attrib($name)) {
            $value =~ s/^\x20*//; # discard leading spaces
            $value =~ s/\x20*$//; # discard trailing spaces
            $value =~ s/ {1,}/ /g; # all >1 space to single space
        }
        

lib/XML/SAX/PurePerl.pm  view on Meta::CPAN

    }
    
    return;
}

sub cdata_attrib {
    # TODO implement this!
    return 1;
}

sub AttValue {

 view all matches for this distribution


XML-SAXDriver-vCard

 view release on metacpan or  search on metacpan

lib/XML/SAXDriver/vCard.pm  view on Meta::CPAN

  $self->SUPER::start_element({Name=>"vCard",Attributes=>$attrs});

  #

  # FN:
  $self->_pcdata({name=>"fn",value=>$vcard->{'fn'}});

  # N:
  $self->SUPER::start_element({Name=>"n"});

  foreach ("family","given","other","prefix","suffix") {
    $self->_pcdata({name=>$_,value=>$vcard->{'n'}{$_}});
  }

  $self->SUPER::end_element({Name=>"n"});

  # NICKNAME:
  if (exists($vcard->{'nickname'})) {
    $self->_pcdata({name=>"nickname",value=>$vcard->{'nickname'}});
  }

  # PHOTO:
  if (exists($vcard->{'photo'})) {
    $self->_media({name=>"photo",%{$vcard->{photo}}});
  }

  # BDAY:
  if (exists($vcard->{'bday'})) {
    $self->_pcdata({name=>"bday",value=>$vcard->{'bday'}});
  }

  # ADR:
  if (ref($vcard->{'adr'}) eq "ARRAY") {
    foreach my $adr (@{$vcard->{'adr'}}) {

lib/XML/SAXDriver/vCard.pm  view on Meta::CPAN

      $self->SUPER::start_element({Name=>"adr",
				   Attributes=>{"{}del.type"=>{Name=>"del.type",Value=>$adr->{type}}}
				  });

      foreach ("pobox","extadr","street","locality","region","pcode","country") {
	$self->_pcdata({name=>$_,value=>$adr->{$_}});
      }

      $self->SUPER::end_element({Name=>"adr"});
    }
  }

lib/XML/SAXDriver/vCard.pm  view on Meta::CPAN

  if (ref($vcard->{'tel'}) eq "ARRAY") {

    foreach my $t (@{$vcard->{'tel'}}) {
      &_munge_type(\$t->{type});

      $self->_pcdata({name=>"tel",value=>$t->{number},
		      attrs=>{"{}tel.type"=>{Name=>"tel.type",Value=>$t->{type}}}
		     });
    }
  }

lib/XML/SAXDriver/vCard.pm  view on Meta::CPAN

  if (ref($vcard->{'email'}) eq "ARRAY") {

    foreach my $e (@{$vcard->{'email'}}) {
      &_munge_type(\$e->{type});

      $self->_pcdata({name=>"email",value=>$e->{address},
		      attrs=>{"{}email.type"=>{Name=>"email.type",Value=>$e->{type}}}
		     });
    }
  }

  # MAILER:
  if (exists($vcard->{'mailer'})) {
    $self->_pcdata({name=>"mailer",
		    value=>$vcard->{'mailer'}});
  }

  # TZ:
  if (exists($vcard->{'tz'})) {
    $self->_pcdata({name=>"tz",
		    value=>$vcard->{'tz'}});
  }

  # GEO:
  if (exists($vcard->{'geo'})) {
    $self->SUPER::start_element({Name=>"geo"});
    $self->_pcdata({name=>"lat",value=>$vcard->{'geo'}{'lat'}});
    $self->_pcdata({name=>"lon",value=>$vcard->{'geo'}{'lon'}});
    $self->SUPER::end_element({Name=>"geo"});
  }

  # TITLE:
  if (exists($vcard->{'title'})) {
    $self->_pcdata({name=>"title",value=>$vcard->{'title'}});
  }

  # ROLE
  if (exists($vcard->{'role'})) {
    $self->_pcdata({name=>"role",value=>$vcard->{'role'}});
  }

  # LOGO:
  if (exists($vcard->{'logo'})) {
    $self->_media({name=>"logo",%{$vcard->{'logo'}}});

lib/XML/SAXDriver/vCard.pm  view on Meta::CPAN

  # AGENT:
  if (exists($vcard->{agent})) {
    $self->SUPER::start_element({Name=>"agent"});

    if ($vcard->{agent}{uri}) {
      $self->_pcdata({name=>"extref",attrs=>{"{}uri"=>{Name=>"uri",
						       Value=>$vcard->{'agent'}{'uri'}}}
		     });
    }

    else {

lib/XML/SAXDriver/vCard.pm  view on Meta::CPAN

  }

  # ORG:
  if (exists($vcard->{'org'})) {
    $self->SUPER::start_element({Name=>"org"});
    $self->_pcdata({name=>"orgnam",value=>$vcard->{'org'}{'name'}});
    $self->_pcdata({name=>"orgunit",value=>$vcard->{'org'}{'unit'}});
    $self->SUPER::end_element({Name=>"org"});
  }

  # CATEGORIES:
  if (ref($vcard->{'categories'}) eq "ARRAY") {
    $self->SUPER::start_element({Name=>"categories"});
    foreach (@{$vcard->{categories}}) {
      $self->_pcdata({name=>"item",value=>$_});
    }
    $self->SUPER::end_element({Name=>"categories"});
  }

  # NOTE:
  if (exists($vcard->{'note'})) {
    $self->_pcdata({name=>"note",value=>$vcard->{'note'}});
  }

  # SORT:
  if (exists($vcard->{'sort'})) {
    $self->_pcdata({name=>"sort",value=>$vcard->{'sort'}});
  }

  # SOUND:
  if (exists($vcard->{'sound'})) {
    $self->_media({name=>"sound",%{$vcard->{'sound'}}});
  }

  # URL:
  if (ref($vcard->{'url'}) eq "ARRAY") {
    foreach (@{$vcard->{'url'}}) {
      $self->_pcdata({name=>"url",
		      Attributes=>{"{}uri"=>{Name=>"uri",Value=>$_}}});
    }
  }

  # KEY:

lib/XML/SAXDriver/vCard.pm  view on Meta::CPAN

  $self->SUPER::end_element({Name=>"vCard"});

  return 1;
}

sub _pcdata {
  my $self = shift;
  my $data = shift;
  $self->SUPER::start_element({Name=>$data->{name},Attributes=>$data->{attrs}});
  $self->SUPER::start_cdata() if ($data->{cdata});
  $self->SUPER::characters({Data=>$data->{value}});
  $self->SUPER::end_cdata() if ($data->{cdata});
  $self->SUPER::end_element({Name=>$data->{name}});
  return 1;
}

sub _media {

lib/XML/SAXDriver/vCard.pm  view on Meta::CPAN

  }

  $self->SUPER::start_element({Name=>$data->{name},Attributes=>$attrs});

  if ($data->{url}) {
     $self->_pcdata({name=>"extref",attrs=>{"{}uri"=>{Name=>"uri",
						      Value=>$data->{url}}}
		    });
  }

  else {
    $self->_pcdata({name=>"b64bin",value=>$data->{b64},cdata=>1});
  }

  $self->SUPER::end_element({Name=>$data->{name}});
  return 1;
}

 view all matches for this distribution


XML-SRS

 view release on metacpan or  search on metacpan

t/24-xml-draft-nzrs-srs-01.t  view on Meta::CPAN


plan tests => @tests * 3;

my $xml_compare = XML::Compare->new(
	ignore => [
		q{//Error//text()},  # FIXME - cdata types
		q{//DomainNameFilter/text()},  # FIXME - cdata types
		q{//AuditText/text()},  # FIXME - cdata types
		q{//AccessControlListQry/@FullResult},
	],
);

for my $test ( sort @tests ) {

 view all matches for this distribution


XML-STX

 view release on metacpan or  search on metacpan

STX/Base.pm  view on Meta::CPAN

# tokens
$NCName = '[A-Za-z_][\w\\.\\-]*';
$QName = "($NCName:)?$NCName";
$NCWild = "${NCName}:\\*|\\*:${NCName}";
$QNWild = "\\*";
$NODE_TYPE = '((text|comment|processing-instruction|node|cdata)\\(\\))';
$NUMBER_RE = '\d+(\\.\d*)?|\\.\d+';
$DOUBLE_RE = '\d+(\\.\d*)?[eE][+-]?\d+';
$LITERAL = '\\"[^\\"]*\\"|\\\'[^\\\']*\\\'';
$URIREF = '[a-z][\w\;\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\'\(\)\%]+';

STX/Base.pm  view on Meta::CPAN

	    } elsif ($seq->[0]->[0]->{Type} == STX_ATTRIBUTE_NODE) {
		$type .= '-attribute';
	    } elsif ($seq->[0]->[0]->{Type} == STX_TEXT_NODE) {
		$type .= '-text';
	    } elsif ($seq->[0]->[0]->{Type} == STX_CDATA_NODE) {
		$type .= '-cdata';
	    } elsif ($seq->[0]->[0]->{Type} == STX_PI_NODE) {
		$type .= '-processing-instruction';
	    } elsif ($seq->[0]->[0]->{Type} == STX_COMMENT_NODE) {
		$type .= '-comment';
	    } else {

STX/Base.pm  view on Meta::CPAN

sub _counter_key($) {
    my ($self, $tok) = @_;

    $tok =~ s/^node\(\)$/\/node/ 
      or $tok =~ s/^text\(\)$/\/text/ 
	or $tok =~ s/^cdata\(\)$/\/cdata/ 
	  or $tok =~ s/^comment\(\)$/\/comment/
	    or $tok =~ s/^processing-instruction\(\)$/\/pi/ 
	      or $tok =~ s/^processing-instruction:(.*)$/\/pi:$1/ 
		or $tok = index($tok, ':') > 0 ? $tok : ':' . $tok;
    $tok =~ s/\*/\/star/;

 view all matches for this distribution


XML-Sablotron

 view release on metacpan or  search on metacpan

DOM/DOM.pm  view on Meta::CPAN

=head2 getNodeName

For ELEMENT_NODE and ATTRIBUTE_NODE returns the name of the node. For
other node types return as follows:

TEXT_NODE => "#text", CDATA_SECTION_NODE => "#cdata-section",
COMMENT_NODE => "#comment", DOCUMENT_NODE => "#document",
PROCESSING_INSTRUCTION_NODE => target of this node

Not in DOM spec.

 view all matches for this distribution


XML-Schema

 view release on metacpan or  search on metacpan

t/builtin.t  view on Meta::CPAN


#------------------------------------------------------------------------
# CDATA

$pkg = 'XML::Schema::Type::CDATA';
my $cdata = $pkg->new();
ok( $cdata );
match( $cdata->name(), 'CDATA' );

$item = $cdata->instance("  \tThe cat\n\tsat on\r\tthe mat\n\t  ");
ok( $item );
match( $item->{ value }, "   The cat  sat on  the mat    ");

#------------------------------------------------------------------------
# token

 view all matches for this distribution


XML-SemanticDiff

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        fix.
        - t/11tag-in-different-locations.t
    - Added a regression test against bug:
        http://rt.cpan.org/Ticket/Display.html?id=2322
        - Seems to already have been fixed.
        - t/12missing-element-has-o-as-cdata.t

0.95 2002-04-09
    [ Undocumented changelog. ]

0.93 2001-06-14

 view all matches for this distribution


XML-Simple

 view release on metacpan or  search on metacpan

t/1_XMLin.t  view on Meta::CPAN

is_deeply($opt, $target, 'keeproot option works');


# confirm that CDATA sections parse correctly

$xml = q{<opt><cdata><![CDATA[<greeting>Hello, world!</greeting>]]></cdata></opt>};
$opt = XMLin($xml, @cont_key);
is_deeply($opt, {
  'cdata' => '<greeting>Hello, world!</greeting>'
}, 'CDATA section parsed correctly');

$xml = q{<opt><x><![CDATA[<y>one</y>]]><![CDATA[<y>two</y>]]></x></opt>};
$opt = XMLin($xml, @cont_key);
is_deeply($opt, {

 view all matches for this distribution


XML-Smart

 view release on metacpan or  search on metacpan

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


#############
# SET_CDATA #
#############

sub set_cdata {
    my $this = shift ;
    $this->set_node_type('cdata',@_) ;
}

##############
# SET_BINARY #
##############

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

Return a copy of the XML::Smart object (pointing to the base).

** This is good when you want to keep 2 versions of the same XML tree in the memory,
since one object can't change the tree of the other!

B<WARNING:> set_node(), set_cdata() and set_binary() changes are not persistant over copy - 
Once you create a second copy these states are lost.

b<warning:> do not copy after apply_dtd() unless you have checked for dtd errors.

=head2  cut_root()

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


=head2  set_auto

Define the key to be handled automatically. Soo, data() will define automatically if it's a node, content or attribute.

I<** This method is useful to remove set_node(), set_cdata() and set_binary() changes.>


=head2  set_auto_node

Define the key as a node, and data() will define automatically if it's CDATA or BINARY.

I<** This method is useful to remove set_cdata() and set_binary() changes.>

=head2  set_binary(BOOL)

Define the node as a BINARY content when TRUE, or force to B<not> handle it as a BINARY on FALSE.

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


Original content of foo (the base64 data):

  <h1>test \x03</h1>

=head2  set_cdata(BOOL)

Define the node as CDATA when TRUE, or force to B<not> handle it as CDATA on FALSE.

Example of CDATA node:

 view all matches for this distribution


XML-Spice

 view release on metacpan or  search on metacpan

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

        my ($val) = @_;
        $val =~ s/'/&apos;/g;
        return $val;
    }

    sub _escape_cdata {
        my ($val) = @_;
        $val =~ s/&/&amp;/g;
        $val =~ s/</&lt;/g;
        $val =~ s/>/&gt;/g;
        $val =~ s/"/&quot;/g;

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

                $xml .= $thing->_xml;
            }

            else {
                next if $thing eq "";
                $xml .= _escape_cdata($thing);
            }
        }

        return $xml;
    }

 view all matches for this distribution


XML-Stream

 view release on metacpan or  search on metacpan

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


        my $lc = lc($module);
        
        eval("\$HANDLERS{\$lc}->{startElement} = \\&XML::Stream::${module}::_handle_element;");
        eval("\$HANDLERS{\$lc}->{endElement}   = \\&XML::Stream::${module}::_handle_close;");
        eval("\$HANDLERS{\$lc}->{characters}   = \\&XML::Stream::${module}::_handle_cdata;");
    }
}

=pod

 view all matches for this distribution


XML-TMX

 view release on metacpan or  search on metacpan

lib/XML/TMX/Reader.pm  view on Meta::CPAN

                 for my $v (@$c) {
                     if ($v->[0] eq "-prop") {
                         push @{$tuv->{$v->[0]}{$v->[1]}}, $v->[2]
                     } elsif ($v->[0] eq "-note") {
                         push @{$tuv->{$v->[0]}}, $v->[1]
                     } elsif ($v->[0] eq "-cdata") {
                         $tuv->{-iscdata} = 1;
                         $tuv->{-seg} = $v->[1];
                     } else {
                         $tuv->{-seg} = $v->[0];
                     }
                 }
                 [ $v{lang} || $v{'xml:lang'} || "_" => $tuv ]
             },
             prop => sub { ["-prop", $v{type} || "_", $c] },
             note => sub { ["-note" , $c] },
             seg  => sub {
                 return ($v{iscdata}) ? [ -cdata => $c ] : [ $c ]
             },
             -cdata => sub { 
                father->{'iscdata'} = 1; $c },
             hi   => sub { $self->{ignore_markup}?$c:toxml },
             ph   => sub { $self->{ignore_markup}?$c:toxml },
            );


 view all matches for this distribution


XML-Tape

 view release on metacpan or  search on metacpan

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

    $this->{parser} = new XML::Parser( Handlers => {
                    Start      => sub { $this->handle_start(@_); },
                    Char       => sub { $this->handle_char(@_); },
                    Comment    => sub { $this->handle_comment(@_); },
                    Proc       => sub { $this->handle_proc(@_); },
                    CdataStart => sub { $this->handle_cdata_start(@_); },
                    CdataEnd   => sub { $this->handle_cdata_end(@_); },
                    End        => sub { $this->handle_end(@_); },
                    Final      => sub { $this->handle_final(@_); },
                      });

    $this->{parsernb} = $this->{parser}->parse_start();

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

    elsif ($this->{nav}->{in_record}) {
        $this->{curr}->addRecordXML($xp->original_string);
    }
}

sub handle_cdata_start {
    my ($this, $xp) = @_;

    if (0) {}
    elsif ($this->{nav}->{in_tape_admin}) {
        $this->{curr}->addAdminXML($xp->original_string);

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

    elsif ($this->{nav}->{in_record}) {
        $this->{curr}->addRecordXML($xp->original_string);
    }
}

sub handle_cdata_end {
    my ($this, $xp) = @_;

    if (0) {}
    elsif ($this->{nav}->{in_tape_admin}) {
        $this->{curr}->addAdminXML($xp->original_string);

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

    $this->{parser} = new XML::Parser( Handlers => {
                    Start      => sub { $this->handle_start(@_); },
                    Char       => sub { $this->handle_char(@_); },
                    Comment    => sub { $this->handle_comment(@_); },
                    Proc       => sub { $this->handle_proc(@_); },
                    CdataStart => sub { $this->handle_cdata_start(@_); },
                    CdataEnd   => sub { $this->handle_cdata_end(@_); },
                    End        => sub { $this->handle_end(@_); },
                    Final      => sub { $this->handle_final(@_); },
                      });

    $this->{parsernb} = $this->{parser}->parse_start();

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

    elsif ($this->{nav}->{in_record}) {
        $this->{curr}->addRecordXML($xp->original_string);
    }
}

sub handle_cdata_start {
    my ($this, $xp) = @_;

    if (0) {}
    elsif ($this->{nav}->{in_tape_admin}) {
        $this->{curr}->addAdminXML($xp->original_string);

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

    elsif ($this->{nav}->{in_record}) {
        $this->{curr}->addRecordXML($xp->original_string);
    }
}

sub handle_cdata_end {
    my ($this, $xp) = @_;

    if (0) {}
    elsif ($this->{nav}->{in_tape_admin}) {
        $this->{curr}->addAdminXML($xp->original_string);

 view all matches for this distribution


XML-Tiny

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

t/02-oddballs.t
t/two-docs.xml
t/doc-and-a-bit.xml
t/text-only.xml
t/03-attribs.t
t/04-cdata.t
t/05-fatal_declarations.t
t/06-entities.t
t/99-w3c-not-wf.t
t/w3c/not-wf/ext-sa/001.ent
t/w3c/not-wf/ext-sa/001.xml

MANIFEST  view on Meta::CPAN

t/51-localize-filehandle.t
t/localize-filehandles.xml
ARTISTIC.txt
GPL2.txt
t/52-bugfix-namecharacters.t
t/53-bugfix-cdata-in-attrib.t
t/cdata-in-attrib.xml
t/54-bugfix-bom.t
t/bom-UTF-16-BE.xml
t/bom-UTF-16-LE.xml
t/bom-UTF-8.xml
t/bom-UTF-32-BE.xml

 view all matches for this distribution


( run in 1.900 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )