view release on metacpan or search on metacpan
bin/dtddiff view on Meta::CPAN
my $attr_info1 = $attrs1->{$aname};
my $attr_info2 = $attrs2->{$aname};
my $attr_value1 = $attr_info1->{'value'};
my $attr_value2 = $attr_info2->{'value'};
my $attr_def1 = $attr_info1->{'default'};
my $attr_def2 = $attr_info2->{'default'};
my $attr_type1 = $attr_info1->{'type'};
my $attr_type2 = $attr_info2->{'type'};
$attr_def1 = lc $attr_def1 if $dtd1->{'namecase-general'} &&
$attr_type1 !~ /^cdata$/i;
$attr_def2 = lc $attr_def2 if $dtd2->{'namecase-general'} &&
$attr_type2 !~ /^cdata$/i;
$attr_value1 = lc $attr_value1 if $dtd1->{'namecase-general'};
$attr_value2 = lc $attr_value2 if $dtd2->{'namecase-general'};
if ($attr_type1 ne $attr_type2 ||
$attr_value1 ne $attr_value2 ||
$attr_def1 ne $attr_def2 ||
$attr_info1->{'enumeration'} ne $attr_info2->{'enumeration'}) {
push(@$attrs_diff, $aname);
}
bin/dtddiff view on Meta::CPAN
if ($gi eq 'parament-name') {
last SW if !defined($cur_dtd_elem) || !defined($cur_model);
$$cur_model .= $model_group if (!$first_in_group[$#first_in_group]);
$$cur_model .= '%'.$attr{'name'}.';';
$first_in_group[$#first_in_group] = 0;
push(@$tree_node, '%'.$attr{'name'}.';');
last SW;
}
if ($gi eq 'pcdata') {
last SW if !defined($cur_dtd_elem) || !defined($cur_model);
$$cur_model .= $model_group if (!$first_in_group[$#first_in_group]);
$$cur_model .= '#PCDATA';
$first_in_group[$#first_in_group] = 0;
push(@$tree_node, '#PCDATA');
last SW;
}
if ($gi eq 'rcdata') {
last SW if !defined($cur_dtd_elem) || !defined($cur_model);
$$cur_model .= 'RCDATA';
push(@$tree_node, 'RCDATA');
last SW;
}
if ($gi eq 'cdata') {
last SW if !defined($cur_dtd_elem) || !defined($cur_model);
$$cur_model .= 'CDATA';
push(@$tree_node, 'CDATA');
last SW;
}
if ($gi eq 'empty') {
last SW if !defined($cur_dtd_elem) || !defined($cur_model);
$$cur_model .= 'EMPTY';
push(@$tree_node, 'EMPTY');
bin/dtdflatten view on Meta::CPAN
$text = &expandPE($text);
my $quote = '"';
if ($text =~ /\"/s) {
$quote = "'";
$text =~ s/\'/\'/sg;
}
print $out_fh "$quote$text$quote>\n";
} elsif ($decl->type() eq 'ndata'
|| $decl->type() eq 'cdata') {
my $name = $decl->name();
my $public = $decl->public();
my $system = $decl->system();
print $out_fh "<!ENTITY $name ";
if ($public) {
my $quote = '"';
if ($public =~ /\"/s) {
$quote = "'";
bin/dtdformat view on Meta::CPAN
if ($type eq 'param') {
if ($ent->getAttribute('system') || $ent->getAttribute('public')) {
$type = 'paramext';
} elsif ($text && $text->getFirstChild()) {
my $data = $text->getFirstChild()->getData();
if ($data eq 'INCLUDE' || $data eq 'IGNORE') {
$type = 'msparam';
}
}
} elsif (($type eq 'gen') || ($type eq 'cdata')) {
if ($text && $text->getFirstChild()) {
my $data = $text->getFirstChild()->getData();
if ($data =~ /^\&\#[xX][0-9A-F]+\;/i
|| $data =~ /^\&\#[0-9]+\;/i) {
$type = 'charent';
}
}
}
return $type;
bin/dtdformat view on Meta::CPAN
my $text = shift;
my $cmfragment = 1;
# if it contains a keyword, it's not a content model fragment.
$cmfragment = 0 if $text =~ /\#implied|\#required|\#fixed/is;
# if it contains characters that can't appear in a content
# model fragment, then it isn't one.
# The string #PCDATA is allowed, but would confuse us...
$text =~ s/\#pcdata//isg;
$cmfragment = 0 if $text =~ /[^\sa-z0-9_\|\,\&\(\)\*\?\+\-]/is;
return $cmfragment;
}
# ======================================================================
my $lastmsglen = 0;
my $persist = 0;
etc/dtd.dtd view on Meta::CPAN
<!ELEMENT text (#PCDATA)*>
<!ELEMENT text-expanded (#PCDATA)*>
<!ELEMENT element (content-model-expanded, content-model?,
inclusions?, exclusions?)>
<!ATTLIST element
name CDATA #REQUIRED
stagm CDATA #IMPLIED
etagm CDATA #IMPLIED
content-type (element|mixed|cdata|empty|rcdata) #IMPLIED
>
<!ENTITY % cm.mix "sequence-group|or-group|and-group
|element-name|parament-name
|pcdata|cdata|rcdata|empty">
<!ELEMENT content-model-expanded (%cm.mix;)>
<!ELEMENT content-model (%cm.mix;)>
<!ELEMENT inclusions (%cm.mix;)>
<!ELEMENT exclusions (%cm.mix;)>
<!ELEMENT sequence-group (%cm.mix;)*>
<!ATTLIST sequence-group
occurrence CDATA #IMPLIED
>
etc/dtd.dtd view on Meta::CPAN
name CDATA #REQUIRED
occurrence CDATA #IMPLIED
>
<!ELEMENT parament-name EMPTY>
<!ATTLIST parament-name
name CDATA #REQUIRED
>
<!ELEMENT empty EMPTY>
<!ELEMENT pcdata EMPTY>
<!ELEMENT cdata EMPTY>
<!ELEMENT rcdata EMPTY>
<!ELEMENT attlist (attdecl, attribute+)>
<!ATTLIST attlist
name CDATA #REQUIRED
>
<!ELEMENT attdecl (#PCDATA)>
<!ELEMENT attribute EMPTY>
<!ATTLIST attribute
lib/SGML/DTDParse.pm view on Meta::CPAN
<!ELEMENT text (#PCDATA)*>
<!ELEMENT text-expanded (#PCDATA)*>
<!ELEMENT element (content-model-expanded, content-model?,
inclusions?, exclusions?)>
<!ATTLIST element
name CDATA #REQUIRED
stagm CDATA #IMPLIED
etagm CDATA #IMPLIED
content-type (element|mixed|cdata|empty|rcdata) #IMPLIED
>
<!ENTITY % cm.mix "sequence-group|or-group|and-group
|element-name|parament-name
|pcdata|cdata|rcdata|empty">
<!ELEMENT content-model-expanded (%cm.mix;)>
<!ELEMENT content-model (%cm.mix;)>
<!ELEMENT inclusions (%cm.mix;)>
<!ELEMENT exclusions (%cm.mix;)>
<!ELEMENT sequence-group (%cm.mix;)*>
<!ATTLIST sequence-group
occurrence CDATA #IMPLIED
>
lib/SGML/DTDParse.pm view on Meta::CPAN
name CDATA #REQUIRED
occurrence CDATA #IMPLIED
>
<!ELEMENT parament-name EMPTY>
<!ATTLIST parament-name
name CDATA #REQUIRED
>
<!ELEMENT empty EMPTY>
<!ELEMENT pcdata EMPTY>
<!ELEMENT cdata EMPTY>
<!ELEMENT rcdata EMPTY>
<!ELEMENT attlist (attdecl, attribute+)>
<!ATTLIST attlist
name CDATA #REQUIRED
>
<!ELEMENT attdecl (#PCDATA)>
<!ELEMENT attribute EMPTY>
<!ATTLIST attribute
lib/SGML/DTDParse/ContentModel.pm view on Meta::CPAN
}
sub xml {
my($self, $depth) = @_;
my($occ) = $self->{'OCCURRENCE'};
my($xml) = "";
$xml .= " " x $depth;
if ($self->{'ELEMENT'} eq '#PCDATA') {
$xml .= "<pcdata/>\n";
} elsif ($self->{'ELEMENT'} eq 'ANY') {
$xml .= "<any/>\n";
} elsif ($self->{'ELEMENT'} eq 'EMPTY') {
$xml .= "<empty/>\n";
} elsif ($self->{'ELEMENT'} eq 'CDATA') {
$xml .= "<cdata/>\n";
} elsif ($self->{'ELEMENT'} eq 'RCDATA') {
$xml .= "<rcdata/>\n";
} else {
$xml .= "<element-name name=\"" . $self->{'ELEMENT'} . "\"";
$xml .= " occurrence=\"$occ\"" if $occ;
$xml .= "/>\n";
}
return $xml;
}
}
lib/SGML/DTDParse/ContentModel.pm view on Meta::CPAN
my $depth = shift;
my @model = @{$self->{'MODEL'}};
$depth = 0 if !defined($depth);
while (@model) {
my $tok = shift @model;
if ((ref $tok) =~ /Element$/) {
return 'mixed' if $tok->element() eq '#PCDATA';
if ($depth == 0) {
return 'cdata' if $tok->element() eq 'CDATA';
return 'rcdata' if $tok->element() eq 'RCDATA';
return 'empty' if $tok->element() eq 'RCDATA';
}
} elsif ((ref $tok) =~ /Group$/) {
my $cm = $tok->content_model();
return $cm->type($depth+1);
}
}
return 'element';
}
lib/SGML/DTDParse/DTD.pm view on Meta::CPAN
$self->{'NOTATION'} = "";
$self->{'PUBLIC'} = $pub;
$self->{'SYSTEM'} = $sys;
$self->{'TEXT'} = $text;
if ($etype =~ /^ndata (\S+)$/i) {
$self->{'TYPE'} = 'ndata';
$self->{'NOTATION'} = $1;
}
if ($etype =~ /^cdata (\S+)$/i) {
$self->{'TYPE'} = 'cdata';
$self->{'NOTATION'} = $1;
}
bless $self, $class;
}
sub name {
my $self = shift;
my $value = shift;
$self->{'NAME'} = $value if defined($value);
lib/SGML/DTDParse/DTD.pm view on Meta::CPAN
}
sub xml {
my $self = shift;
my $xml = "";
my(@attr) = $self->attribute_list();
my($attr, $text);
$xml .= "<attlist name=\"" . $self->name() . "\">\n";
my $cdata = $self->{'DECL'};
$cdata =~ s/&/&/sg;
$cdata =~ s/</</sg;
$xml .= "<attdecl>$cdata</attdecl>\n";
foreach $attr (@attr) {
$xml .= "<attribute name=\"$attr\"\n";
$text = $self->attribute_type($attr);
# $text =~ s/\%/\&/sg;
$xml .= " type=\"$text\"\n";
$text = $self->attribute_values($attr);
# $text =~ s/\%/\&/sg;
lib/SGML/DTDParse/DTD.pm view on Meta::CPAN
($system, $dtd) = $self->next_token($dtd);
$system = $self->trim_quotes($system);
} elsif ($tok =~ /^sdata$/i) {
$type = 'sdata';
($text, $dtd) = $self->next_token($dtd);
$text = $self->trim_quotes($text);
} elsif ($tok =~ /^pi$/i) {
$type = 'pi';
($text, $dtd) = $self->next_token($dtd);
$text = $self->trim_quotes($text);
} elsif ($tok =~ /^cdata$/i) {
$type = 'cdata';
($text, $dtd) = $self->next_token($dtd);
$text = $self->trim_quotes($text);
} else {
die "Error: Unexpected declared entity type ($name): $tok\n";
}
}
($tok, $dtd) = $self->next_token($dtd);
if ($tok =~ /ndata/i) {
($tok, $dtd) = $self->next_token($dtd);
# now $tok contains the notation name
$type = "ndata $tok";
($tok, $dtd) = $self->next_token($dtd);
# now $tok should contain the token after the notation
} elsif ($tok =~ /cdata/i) {
($tok, $dtd) = $self->next_token($dtd);
# now $tok contains the notation name
$type = "cdata $tok";
($tok, $dtd) = $self->next_token($dtd);
# now $tok should contain the token after the notation
}
if ($tok ne '>') {
print "[[", substr($dtd, 0, 100), "]]\n";
die "Error: Unexpected token in ENTITY declaration: $tok\n";
}
print STDERR "ENT: $type $name (P: $public) (S: $system) [$text]\n" if $debug>1;
lib/SGML/DTDParse/Format/html.pl view on Meta::CPAN
if ($node->getTagName() eq 'sequence-group') {
$html .= &formatCMGroup($node, ",");
} elsif ($node->getTagName() eq 'or-group') {
$html .= &formatCMGroup($node, "|");
} elsif ($node->getTagName() eq 'and-group') {
$html .= &formatCMGroup($node, "&");
} elsif ($node->getTagName() eq 'element-name') {
$html .= &formatCMElement($node);
} elsif ($node->getTagName() eq 'parament-name') {
$html .= &formatCMParament($node);
} elsif ($node->getTagName() eq 'pcdata') {
$html .= &formatCMPCDATA($node);
} elsif ($node->getTagName() eq 'cdata') {
$html .= &formatCMCDATA($node);
} elsif ($node->getTagName() eq 'rcdata') {
$html .= &formatCMRCDATA($node);
} elsif ($node->getTagName() eq 'empty') {
$html .= &formatCMEMPTY($node);
} elsif ($node->getTagName() eq 'any') {
$html .= &formatCMANY($node);
} else {
die "Unexpected node: \"" . $node->getTagName() . "\"\n";
}
$node = $node->getNextSibling();
} else {
lib/SGML/DTDParse/Format/html.pl view on Meta::CPAN
if ($type eq 'sdata' || $type eq 'pi') {
$html .= "<H3>" . uc($type) . " Entity</H3>\n";
$text =~ s/\&/\&/sg;
if ($text =~ /\"/) {
$html .= "<P>'$text'</P>\n";
} else {
$html .= "<P>\"$text\"</P>\n";
}
}
if ($type eq 'ndata' || $type eq 'cdata') {
my $notation = $entity->getAttribute("notation");
$html .= "<H3>" . uc($type) . " Entity</H3>\n";
$html .= "<P><B>Notation</B>: $notation</P>\n";
$html .= "<P><B>Public identifier</B>: $public</P>\n" if $public;
$html .= "<P><B>System identifier</B>: $system</P>\n" if $system;
}
return $html;
}
lib/SGML/DTDParse/Format/refentry.pl view on Meta::CPAN
if ($node->getTagName() eq 'sequence-group') {
$html .= &formatCMGroup($node, ",");
} elsif ($node->getTagName() eq 'or-group') {
$html .= &formatCMGroup($node, "|");
} elsif ($node->getTagName() eq 'and-group') {
$html .= &formatCMGroup($node, "&");
} elsif ($node->getTagName() eq 'element-name') {
$html .= &formatCMElement($node);
} elsif ($node->getTagName() eq 'parament-name') {
$html .= &formatCMParament($node);
} elsif ($node->getTagName() eq 'pcdata') {
$html .= &formatCMPCDATA($node);
} elsif ($node->getTagName() eq 'cdata') {
$html .= &formatCMCDATA($node);
} elsif ($node->getTagName() eq 'rcdata') {
$html .= &formatCMRCDATA($node);
} elsif ($node->getTagName() eq 'empty') {
$html .= &formatCMEMPTY($node);
} elsif ($node->getTagName() eq 'any') {
$html .= &formatCMANY($node);
} else {
die "Unexpected node: \"" . $node->getTagName() . "\"\n";
}
$node = $node->getNextSibling();
} else {
lib/SGML/DTDParse/Format/refentry.pl view on Meta::CPAN
my $html = "";
$html .= "<refmeta>\n";
$html .= "<refentrytitle>";
$html .= $entity->getAttribute('name');
$html .= "</refentrytitle>\n";
if ($type eq 'gen') {
$html .= "<refmiscinfo>General Entity</refmiscinfo>\n";
} elsif ($type eq 'ndata'
|| $type eq 'cdata'
|| $type eq 'sdata'
|| $type eq 'pi') {
$html .= "<refmiscinfo>" . uc($type) . " Entity</refmiscinfo>\n";
} else {
$html .= "<refmiscinfo>Parameter Entity</refmiscinfo>\n";
}
$html .= "</refmeta>\n\n";
$html .= "<refnamediv>\n";
lib/SGML/DTDParse/Format/refentry.pl view on Meta::CPAN
} else {
$html .= $match;
}
}
$html .= $text;
$html .= "</synopsis></entry>\n";
$html .= "</row>\n";
}
}
if ($type eq 'ndata' || $type eq 'cdata') {
my $notation = $entity->getAttribute('notation');
$html .= uc($type) . " Entity";
$html .= "</emphasis></entry>\n";
$html .= "</row>\n";
$html .= "<row rowsep='1' role='cmsynop'>\n";
$html .= "<entry namest='c1' nameend='c3' align='left'\n";
$html .= ">";
$html .= "<para><emphasis role='bold'>Notation</emphasis>: $notation\n</para>";