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/RSS10.pm view on Meta::CPAN
$self->_contents( \%p, qw( title link ) );
$self->_call_modules( \%p );
if ( defined $p{description} ) {
$self->_element_with_cdata( '', 'description', $p{description} );
$self->_newline_if_pretty;
}
$self->_end_element( '', 'item' );
$self->_newline_if_pretty;
lib/XML/Generator/RSS10.pm view on Meta::CPAN
);
$self->_newline_if_pretty;
$self->_contents( \%p, qw( title link ) );
$self->_element_with_cdata( '', 'description', $p{description} );
$self->_newline_if_pretty;
foreach my $elt ( grep { $self->{state}{$_} } qw( image textinput ) ) {
$self->_element(
'', $elt,
lib/XML/Generator/RSS10.pm view on Meta::CPAN
$self->_start_element(@_);
$self->characters( { Data => $data } ) if length $data;
$self->_end_element(@_);
}
sub _element_with_cdata {
my $self = shift;
my $data = pop;
$self->_start_element(@_);
if ( length $data ) {
$self->start_cdata;
$self->characters( { Data => $data } );
$self->end_cdata;
}
$self->_end_element(@_);
}
sub _start_element {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
Attributes => {"{}about" => {Name => "rdf:about",
Value => $self->base()}}});
#
$self->_pcdata({Name => "vCard:CLASS",
Value => ($vcard->class() || "PUBLIC")});
foreach my $prop ("uid", "rev", "prodid") {
if (my $value = $vcard->$prop()) {
$self->_pcdata({Name => sprintf("vCard:%s",uc($prop)),
Value => $value});
}
}
#
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
sub _render_fn {
my $self = shift;
my $vcard = shift;
$self->_pcdata({Name => "vCard:FN",
Value => $vcard->fn()});
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
$self->start_element({Name => "vCard:N",
Attributes => {"{}parseType"=>{Name => "rdf:parseType",
Value => "Resource"}},});
if (my $f = $n->family()) {
$self->_pcdata({Name => "vCard:Family",
Value => $n->family()});
}
if (my $g = $n->given()) {
$self->_pcdata({Name => "vCard:Given",
Value => $n->given()});
}
if (my $o = $n->middle()) {
$self->_pcdata({Name => "vCard:Other",
Value => $o});
}
if (my $p = $n->prefixes()) {
$self->_pcdata({Name => "vCard:Prefix",
Value => $p});
}
if (my $s = $n->suffixes()) {
$self->_pcdata({Name => "vCard:Suffix",
Value => $s});
}
$self->end_element({Name => "vCard:N"});
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
sub _render_nickname {
my $self = shift;
my $vcard = shift;
if (my $nick = $vcard->nickname()) {
$self->_pcdata({Name => "vCard:NICKNAME",
Value => $nick});
}
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
sub _render_bday {
my $self = shift;
my $vcard = shift;
if (my $bday = $vcard->bday()) {
$self->_pcdata({Name => "vCard:BDAY",
Value => $bday});
}
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
sub {
my $self = shift;
my $adr = shift;
if (my $p = $adr->po_box()) {
$self->_pcdata({Name => "vCard:pobox",
Value => $p});
}
if (my $e = $adr->extended()) {
$self->_pcdata({Name => "vCard:extadr",
Value => $e});
}
if (my $s = $adr->street()) {
$self->_pcdata({Name => "vCard:Street",
Value => $s});
}
if (my $c = $adr->city()) {
$self->_pcdata({Name => "vCard:Locality",
Value => $c});
}
if (my $r = $adr->region()) {
$self->_pcdata({Name => "vCard:Region",
Value => $r});
}
if (my $p = $adr->post_code()) {
$self->_pcdata({Name => "vCard:Pcode",
Value => $p});
}
if (my $c = $adr->country()) {
$self->_pcdata({Name => "vCard:Country",
Value => $c});
}
});
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
$labels,
sub {
my $self = shift;
my $label = shift;
$self->_pcdata({Name => "rdf:value",
Value => $label->value(),
Attributes => {$self->_parsetype("Literal")},
CDATA => 1,});
});
return 1;
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
$tels,
sub {
my $self = shift;
my $tel = shift;
$self->_pcdata({Name => "rdf:value",
Value => $tel->value()});
});
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
$addresses,
sub {
my $self = shift;
my $email = shift;
$self->_pcdata({Name => "rdf:value",
Value => $email->value()});
});
# Keep track of email addresses for
# dumping by '_render_foaf_mboxes'
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
$accounts,
sub {
my $self = shift;
my $im = shift;
$self->_pcdata({Name => "rdf:value",
Value => $im->value()});
});
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
sub _render_mailer {
my $self = shift;
my $vcard = shift;
if (my $m = $vcard->mailer()) {
$self->_pcdata({Name => "vCard:MAILER",
Value => $m});
}
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
sub _render_tz {
my $self = shift;
my $vcard = shift;
if (my $tz = $vcard->tz()) {
$self->_pcdata({Name => "vCard:TZ",
Value => $tz});
}
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
$self->start_element({Name => "vCard:GEO",
Attributes => {"{}parseType"=>{Name => "rdf:parseType",
Value => "Resource"}},});
$self->_pcdata({Name => "geo:lat",
Value => $geo->lat()});
$self->_pcdata({Name => "geo:lon",
Value => $geo->long()});
$self->end_element({Name=>"vCard:GEO"});
return 1;
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
$self->start_element({Name => "vCard:ORG",
Attributes => \%parsetype});
if (my $n = $org->name()) {
$self->_pcdata({Name => "vCard:Orgnam",
Value => $n});
}
if (my $u = $org->unit()) {
my @units = grep { /\w/ } @$u;
my $count = scalar(@units);
if ($count == 1) {
$self->_pcdata({Name => "vCard:Orgunit",
Value => $units[0]});
}
elsif ($count) {
$self->start_element({Name => "vCard:Orgunit"});
$self->start_element({Name => "rdf:Seq"});
map {
$self->_pcdata({Name => "rdf:li",
Value => $_});
} @units;
$self->end_element({Name => "rdf:Seq"});
$self->end_element({Name => "vCard:Orgunit"});
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
sub _render_title {
my $self = shift;
my $vcard = shift;
if (my $t = $vcard->title()) {
$self->_pcdata({Name => "vCard:TITLE",
Value => $t});
}
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
sub _render_role {
my $self = shift;
my $vcard = shift;
if (my $r = $vcard->role()) {
$self->_pcdata({Name => "vCard:ROLE",
Value => $r});
}
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
$self->start_element({Name => "vCard:CATEGORIES"});
$self->start_element({Name => "rdf:Seq"});
foreach my $c (@$cats) {
$self->_pcdata({Name => "rdf:li",
Value => $c->value()});
}
$self->end_element({Name => "rdf:Seq"});
$self->end_element({Name => "vCard:CATEGORIES"});
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
if (! $notes) {
return 1;
}
$self->_pcdata({Name => "vCard:NOTE",
Attributes => {$self->_parsetype("Literal")},
CDATA => 1,
Value => $notes->[0]->value()});
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
sub _render_url {
my $self = shift;
my $vcard = shift;
if (my $url = $vcard->url()) {
$self->_pcdata({Name => "vCard:URL",
Attributes => {"{}resource" => {Name => "rdf:resource",
Value => $url}}});
}
return 1;
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
"msn" => "foaf:msnChatID",
"jabber" => "foaf:JabberID",
"icq" => "foaf:icqChatID"};
}
sub _pcdata {
my $self = shift;
my $data = shift;
$self->start_element($data);
if ($data->{CDATA}) {
$self->start_cdata();
}
if ($data->{Value}) {
$self->characters({Data => encode_utf8($data->{Value})});
}
if ($data->{CDATA}) {
$self->end_cdata();
}
$self->end_element($data);
return 1;
}
lib/XML/Generator/vCard/RDF.pm view on Meta::CPAN
sub _mediaref {
my $self = shift;
my $el = shift;
my $obj = shift;
$self->_pcdata({Name => $el,
Attributes => {"{}resource" => {Name => "rdf:resource",
Value => $obj->value()}}});
}
sub _mediaobj {
my $self = shift;
my $obj = shift;
$self->_types($obj->types());
$self->_pcdata({Name => "vCard:ENCODING",
Value => "b"});
$self->_pcdata({Name => "rdf:value",
Attributes => {$self->_parsetype("Literal")},
Value => encode_base64($obj->value()),
CDATA => 1});
return 1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Generator/vCard.pm view on Meta::CPAN
sub _render_fn {
my $self = shift;
my $vcard = shift;
$self->_pcdata({Name => "vCard:fn",
Value => $vcard->fn()});
return 1;
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
if (($n->family()) || ($n->given())) {
$self->start_element({Name=>"vCard:n"});
$self->_pcdata({Name => "vCard:family",
Value => $n->family()});
$self->_pcdata({Name => "vCard:given",
Value => $n->given()});
if (my $o = $n->middle()) {
$self->_pcdata({Name => "vCard:other",
Value => $o});
}
if (my $p = $n->prefixes()) {
$self->_pcdata({Name => "vCard:prefix",
Value => $p});
}
if (my $s = $n->suffixes()) {
$self->_pcdata({Name => "vCard:suffix",
Value => $s});
}
$self->end_element({Name => "vCard:n"});
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
sub _render_nickname {
my $self = shift;
my $vcard = shift;
if (my $nick = $vcard->nickname()) {
$self->_pcdata({Name => "vCard:nickname",
Value => $nick});
}
return 1;
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
sub _render_bday {
my $self = shift;
my $vcard = shift;
if (my $bday = $vcard->bday()) {
$self->_pcdata({Name => "vCard:bday",
Value => $bday});
}
return 1;
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
Attributes => {"{}del.type" => {Name => "vCard:del.type",
Value => $types}}
});
if (my $p = $adr->po_box()) {
$self->_pcdata({Name => "vCard:pobox",
Value => $p});
}
if (my $e = $adr->extended()) {
$self->_pcdata({Name => "vCard:extadr",
Value => $e});
}
if (my $s = $adr->street()) {
$self->_pcdata({Name => "vCard:street",
Value => $s});
}
if (my $c = $adr->city()) {
$self->_pcdata({Name => "vCard:locality",
Value => $c});
}
if (my $r = $adr->region()) {
$self->_pcdata({Name => "vCard:region",
Value => $r});
}
if (my $p = $adr->post_code()) {
$self->_pcdata({Name => "vCard:pcode",
Value => $p});
}
if (my $c = $adr->country()) {
$self->_pcdata({Name => "vCard:country",
Value => $c});
}
$self->end_element({Name=>"vCard:adr"});
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
foreach my $l (@$labels) {
my $types = join(";",$l->types());
$self->_pcdata({Name => "vCard:label",
Value => $l->value(),
Attributes => {"{}del.type" => {Name => "vCard:del.type",
Value => $types}}
});
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
foreach my $tel (@$numbers) {
my $types = join(";",$tel->types());
$self->_pcdata({Name => "vCard:tel",
Value => $tel->value(),
Attributes => {"{}tel.type" => {Name => "vCard:tel.type",
Value => $types}}
});
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
foreach my $e (@$addresses) {
my $types = join(";",$e->types());
$self->_pcdata({Name => "vCard:email",
Value => $e->value(),
Attributes => {"{}email.type" => {Name => "vCard:email.type",
Value => $types}}
});
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
foreach my $im (@$addresses) {
my $types = join(";",$im->types());
$self->_pcdata({Name => $im_list->{$service},
Value => $im->value(),
Attributes => {"{}im.type"=> {Name => "vCard:im.type",
Value => $types}}
});
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
my $self = shift;
my $vcard = shift;
if (my $m = $vcard->mailer()) {
$self->_pcdata({Name => "vCard:mailer",
Value => $m});
}
return 1;
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
my $self = shift;
my $vcard = shift;
if (my $tz = $vcard->tz()) {
$self->_pcdata({Name => "vCard:tz",
Value => $tz});
}
return 1;
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
#
$self->start_element({Name => "vCard:geo"});
$self->_pcdata({Name => "vCard:lat",
Value => $geo->lat()});
$self->_pcdata({Name => "vCard:lon",
Value => $geo->long()});
$self->end_element({Name => "vCard:geo"});
return 1;
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
foreach my $o (@$orgs) {
$self->start_element({Name => "vCard:org"});
if (my $name = $o->name()) {
$self->_pcdata({Name => "vCard:orgnam",
Value => $name});
}
if (my $units = $o->unit()) {
foreach my $u (grep { /\w/ } @$units) {
$self->_pcdata({Name => "vCard:orgunit",
Value => $u});
}
}
$self->end_element({Name => "vCard:org"});
lib/XML/Generator/vCard.pm view on Meta::CPAN
my $self = shift;
my $vcard = shift;
if (my $t = $vcard->title()) {
$self->_pcdata({Name => "vCard:title",
Value => $t});
}
return 1;
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
my $self = shift;
my $vcard = shift;
if (my $r = $vcard->role()) {
$self->_pcdata({Name => "vCard:role",
Value => $r});
}
return 1;
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
$self->start_element({Name => "vCard:categories"});
foreach (split(",",$cats->[0]->value())) {
$self->_pcdata({Name => "vCard:item",
Value => $_});
}
$self->end_element({Name => "vCard:categories"});
return 1;
lib/XML/Generator/vCard.pm view on Meta::CPAN
if (! $n) {
return 1;
}
if (my $n = $vcard->note()) {
$self->_pcdata({Name => "vCard:note",
CDATA => 1,
Value => $n});
}
return 1;
lib/XML/Generator/vCard.pm view on Meta::CPAN
sub _render_url {
my $self = shift;
my $vcard = shift;
if (my $url = $vcard->url()) {
$self->_pcdata({Name => "vCard:url",
Attributes => {"{}uri" => {Name => "vCard:uri",
Value => $url}}});
}
return 1;
lib/XML/Generator/vCard.pm view on Meta::CPAN
"msn" => "foaf:msnChatID",
"jabber" => "foaf:JabberID",
"icq" => "foaf:icqChatID"};
}
sub _pcdata {
my $self = shift;
my $data = shift;
$self->start_element($data);
if ($data->{CDATA}) {
$self->start_cdata();
}
if ($data->{Value}) {
$self->characters({Data => encode_utf8($data->{Value})});
}
if ($data->{CDATA}) {
$self->end_cdata();
}
$self->end_element($data);
return 1;
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
$self->start_element({Name => $data->{name},
Attributes => $attrs});
if ($obj->is_type("base64")) {
$self->_pcdata({Name => "vCard:b64bin",
Value => encode_base64($obj->value()),
CDATA => 1});
}
else {
$self->_pcdata({Name => "extref",
Attributes => {"{}uri" => {Name => "vCard:uri",
Value => $obj->value()}}
});
}
lib/XML/Generator/vCard.pm view on Meta::CPAN
foreach my $foo (@$custom) {
my $types = join(";",$foo->types());
$self->_pcdata({Name => "foo:bar",
Value => $foo->value(),
Attributes => {"{}type"=> {Name => "type",
Value => $types}}
});
}
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
view release on metacpan or search on metacpan
lib/XML/GenericJSON.pm view on Meta::CPAN
my @types=(0,
'element', #1
'attribute', #2
'text', #3
'cdata', #4
'entity_ref', #5
'entity_node', #6
'pi', #7
'comment', #8
'document', #9
lib/XML/GenericJSON.pm view on Meta::CPAN
my $strip_whitespace = 1;
$strip_whitespace = shift if defined $_[0];
my $perlish_node = {};
if ($xml_node->nodeType == 3) {#text - just store the scalar
return $xml_node->data;
}elsif (defined $simple_types->{$xml_node->nodeType}) {#cdata,pi,comment - store type plus data
$perlish_node->{type} = $types[$xml_node->nodeType];
$perlish_node->{data} = $xml_node->nodeValue;
return $perlish_node;
} else {#Probably an element, but it should work regardless
$perlish_node->{type} = $types[$xml_node->nodeType];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Grammar/Fortune/ToText.pm view on Meta::CPAN
my @text_childs = $text_node->childNodes();
if ( @text_childs != 1 )
{
Carp::confess('@cdata is not 1');
}
my $cdata = $text_childs[0];
if ( $cdata->nodeType() != XML_CDATA_SECTION_NODE() )
{
Carp::confess("Not a cdata");
}
my $value = $cdata->nodeValue();
$value =~ s{\n+\z}{}g;
$self->_out("$value\n");
return;
view all matches for this distribution
view release on metacpan or search on metacpan
extradata/xhtml-notations-1.mod view on Meta::CPAN
<!-- W3C XML 1.0 Recommendation -->
<!NOTATION w3c-xml
PUBLIC "ISO 8879//NOTATION Extensible Markup Language (XML) 1.0//EN" >
<!-- XML 1.0 CDATA -->
<!NOTATION cdata
PUBLIC "-//W3C//NOTATION XML 1.0: CDATA//EN" >
<!-- SGML Formal Public Identifiers -->
<!NOTATION fpi
PUBLIC "ISO 8879:1986//NOTATION Formal Public Identifier//EN" >
view all matches for this distribution
view release on metacpan or search on metacpan
lib/XML/Grove.pm view on Meta::CPAN
$type_name = 'characters';
package XML::Grove::CData;
use vars qw{ @ISA $type_name };
@ISA = qw{XML::Grove};
$type_name = 'cdata';
package XML::Grove::ElementDecl;
use vars qw{ @ISA $type_name };
@ISA = qw{XML::Grove};
$type_name = 'element_decl';
view all matches for this distribution
view release on metacpan or search on metacpan
Composer.pm view on Meta::CPAN
$self->print (&$esc ($event->{Data}));
}
}
sub start_cdata
{
my $self = shift;
$self->{InCDATA} = 1;
$self->print ("<![CDATA[");
}
sub end_cdata
{
my $self = shift;
$self->{InCDATA} = 0;
$self->print ("]]>");
view all matches for this distribution
view release on metacpan or search on metacpan
sub end_element {}
sub characters {}
sub processing_instruction {}
sub ignorable_whitespace {}
sub comment {}
sub start_cdata {}
sub end_cdata {}
sub start_entity {}
sub end_entity {}
sub xml_decl {}
sub start_dtd {
view all matches for this distribution