XML-DTD
view release on metacpan or search on metacpan
lib/XML/DTD/AttDef.pm view on Meta::CPAN
# Write component-specific part of the XML representation
sub writexmlelts {
my $self = shift;
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;
}
# Return the attribute name
sub name {
my $self = shift;
return $self->{'NAME'};
lib/XML/DTD/Comment.pm view on Meta::CPAN
}
# Write an XML representation
sub writexml {
my $self = shift;
my $xmlw = shift;
my $tag = $self->{'CMPNTTYPE'};
$xmlw->open($tag);
$xmlw->pcdata($self->{'WITHINDELIM'}, {'subst' => {'&' => '&'}});
$xmlw->close;
}
1;
__END__
=head1 NAME
XML::DTD::Comment - Perl module representing a comment in a comment in a DTD
lib/XML/DTD/Component.pm view on Meta::CPAN
# Write an XML representation
sub writexml {
my $self = shift;
my $xmlw = shift;
my $tag = $self->{'CMPNTTYPE'};
my $atr = $self->xmlattrib;
$xmlw->open($tag, $atr);
$xmlw->open('unparsed');
if (defined($self->{'WITHINDELIM'})) {
$xmlw->pcdata($self->{'WITHINDELIM'});
} else {
$xmlw->pcdata($self->{'UNPARSEDTEXT'});
}
$xmlw->close;
$self->writexmlelts($xmlw);
$xmlw->close;
}
# Return attributes for XML representation
sub xmlattrib {
my $self = shift;
lib/XML/DTD/Element.pm view on Meta::CPAN
sub writexml {
my $self = shift;
my $xmlw = shift;
$xmlw->open('element', {'name' => $self->{'NAME'},
'ltws' => $self->{'WS0'}});
my $ws2 = (defined($self->{'WS2'}) and $self->{'WS2'} ne '')?
$self->{'WS2'}:undef;
my $ws = {'ltws' => $self->{'WS1'}, 'rtws' => $ws2};
$xmlw->open('contentspec', $ws);
$xmlw->pcdata($self->{'CONTENTSPECTEXT'});
$xmlw->close;
$self->{'CONTENTSPEC'}->writexmlelts($xmlw);
$xmlw->close;
}
# Return the element name
sub name {
my $self = shift;
lib/XML/DTD/Entity.pm view on Meta::CPAN
my $type = ($self->isparam)?'param':'gen';
my $tstr = ($self->isparam)?$self->{'WS0'}.'%':undef;
my $ltws = ($self->isparam)?$self->{'WS1'}:$self->{'WS0'};
$xmlw->open('entity', {'name' => $name, 'type' => $type, 'tstr' => $tstr,
'ltws' => $ltws, 'rtws' => $self->{'WSRT'}});
if ($self->isextern) {
$xmlw->open('external', {'ltws' => $self->{'WS2'}});
if (defined $self->{'PUBLIC'}) {
$xmlw->open('public', {'qchar' => $self->{'QCPUB'},
'ltws' => $self->{'WSPUB'}});
$xmlw->pcdata($self->{'PUBLIC'});
$xmlw->close;
}
$xmlw->open('system', {'qchar' => $self->{'QCSYS'},
'ltws' => $self->{'WSSYS'}});
$xmlw->pcdata($self->{'SYSTEM'});
$xmlw->close;
$xmlw->close;
} else {
$xmlw->open('internal', {'qchar' => $self->{'QUOTECHAR'},
'ltws' => $self->{'WS2'}});
$xmlw->pcdata($self->value);
$xmlw->close;
}
$xmlw->close;
}
# Parse the entity declaration
sub _parse {
my $self = shift;
my $entdcl = shift;
lib/XML/DTD/Ignore.pm view on Meta::CPAN
return $self;
}
# Write an XML representation
sub writexml {
my $self = shift;
my $xmlw = shift;
$xmlw->open('ignore', {'ltdlm' => $self->{'IGNLT'}});
$xmlw->pcdata($self->{'WITHINDELIM'}, {'subst' => {"\n" => '
'}});
$xmlw->close;
}
1;
__END__
=head1 NAME
XML::DTD::Ignore - Perl module representing an ignore section in a DTD
lib/XML/DTD/Text.pm view on Meta::CPAN
my $self = shift;
my $xmlw = shift;
my $tag = $self->{'CMPNTTYPE'};
my $txt = $self->{'UNPARSEDTEXT'};
my $tmp = $txt;
$tmp =~ s/[^\n]//g;
my $nlf = length($tmp);
$txt =~ s/\n/\&\#xA;/g;
$xmlw->open($tag, {'nlf' => $nlf});
$xmlw->pcdata($txt);
$xmlw->close;
}
1;
__END__
=head1 NAME
XML::DTD::Text - Perl module representing text (primarily whitespace) in a DTD
lib/XML/Output.pm view on Meta::CPAN
my $ecnfg = (defined $cnfg)?{ %$cnfg }:{};
$ecnfg->{'empty'} = 1;
$self->open($name, $attr, $ecnfg);
##$self->{'PCDATA'} = 1;
##$self->close();
}
# Print #PCDATA
sub pcdata {
my $self = shift;
my $data = shift;
my $cnfg = shift;
$self->{'PCDATA'} = 1;
my $fh = $self->{'FH'};
my $str = $self->_cesubst($cnfg, $data);
if (defined $fh) {
print $fh $str;
} else {
lib/XML/Output.pm view on Meta::CPAN
XML::Output - Perl module for writing simple XML documents
=head1 SYNOPSIS
use XML::Output;
open(FH,'>file.xml');
my $xo = new XML::Output({'fh' => *FH});
$xo->open('tagname', {'attrname' => 'attrval'});
$xo->pcdata('element content');
$xo->close();
close(FH);
=head1 ABSTRACT
XML::Output is a Perl module for writing simple XML documents
=head1 DESCRIPTION
XML::Output is a Perl module for writing simple XML document. The
lib/XML/Output.pm view on Meta::CPAN
$xo->close;
Close an element
=item B<empty>
$xo->empty('tagname', {'attrname' => 'attrval'});
Insert an empty element with specified name (and optional attributes)
=item B<pcdata>
$xo->pcdata('element content');
Insert text
=item B<comment>
$xo->comment('comment text');
Insert a comment
=item B<xmlstr>
( run in 0.292 second using v1.01-cache-2.11-cpan-454fe037f31 )