| 11 |
|
|
| 12 |
for my $src ($src->get_attribute ('ModuleSet') |
for my $src ($src->get_attribute ('ModuleSet') |
| 13 |
|| $src->get_attribute ('DocumentType')) { |
|| $src->get_attribute ('DocumentType')) { |
| 14 |
for (qw/ID Copyright BaseURI Description Version/) { |
for (qw/Description/) { |
| 15 |
$Info->{$_} = $src->get_attribute_value ($_); |
$Info->{$_} = $src->get_attribute_value ($_); |
| 16 |
} |
} |
| 17 |
$Info->{Name} = $src->get_attribute_value ('Name'); |
for (qw/Name ID Copyright BaseURI Version/) { |
| 18 |
|
$Info->{$_} = normalize_wsp ($src->get_attribute_value ($_)); |
| 19 |
|
} |
| 20 |
|
$Info->{realname} = $Info->{Name}; |
| 21 |
$Info->{Name} .= ' ' . $Info->{Version} if length $Info->{Version}; |
$Info->{Name} .= ' ' . $Info->{Version} if length $Info->{Version}; |
| 22 |
$Info->{ns} = $src->get_attribute ('Namespace'); |
$Info->{ns} = $src->get_attribute ('Namespace'); |
| 23 |
} |
} |
| 44 |
} |
} |
| 45 |
exit} |
exit} |
| 46 |
|
|
| 47 |
|
sub normalize_wsp ($;%) { |
| 48 |
|
my $s = shift; |
| 49 |
|
$s =~ s/\s+/ /g; |
| 50 |
|
$s =~ s/^ +//; |
| 51 |
|
$s =~ s/ +$//; |
| 52 |
|
$s; |
| 53 |
|
} |
| 54 |
sub make_paragraphs ($;%) { |
sub make_paragraphs ($;%) { |
| 55 |
my ($para, %opt) = @_; |
my ($para, %opt) = @_; |
| 56 |
join "\n\n", map { |
join "\n\n", map { |
| 223 |
$s; |
$s; |
| 224 |
} |
} |
| 225 |
|
|
| 226 |
|
sub parameter_entity_declaration ($$%) { |
| 227 |
|
my ($src, $Info, %opt) = @_; |
| 228 |
|
my $name = name_of $src, $Info, %opt; |
| 229 |
|
if (my $sysid = $src->get_attribute_value ('SYSTEM')) { |
| 230 |
|
if ($sysid =~ /^\s*<([^<>]+)>\s*$/) { |
| 231 |
|
$sysid = $1; |
| 232 |
|
$sysid =~ s/([%"])/sprintf '&#x%02X;', ord $1/ge; |
| 233 |
|
} elsif ($sysid =~ /^([^:]*):(.*)$/) { |
| 234 |
|
my $ns = $1; |
| 235 |
|
$sysid = $2; |
| 236 |
|
$sysid =~ s/([%"])/sprintf '&#x%02X;', ord $1/ge; |
| 237 |
|
$sysid = '%' . ($ns ? $ns . '.' : '') . 'sysid.base;' . $sysid; |
| 238 |
|
} else { |
| 239 |
|
$sysid = '%XHTML.sysid.base;' . $sysid; |
| 240 |
|
} |
| 241 |
|
my $r; |
| 242 |
|
if (my $pubid = $src->get_attribute_value ('PUBLIC')) { |
| 243 |
|
$r = qq{<!ENTITY % $name.sysid "$sysid">\n} . |
| 244 |
|
qq{<!ENTITY % $name.fpi "$pubid">\n} . |
| 245 |
|
qq{<!ENTITY % $name.fpi.defined "INCLUDE">\n}; |
| 246 |
|
} else { |
| 247 |
|
$r = qq{<!ENTITY % $name.sysid "$sysid">\n} . |
| 248 |
|
qq{<!ENTITY % $name.fpi "">\n} . |
| 249 |
|
qq{<!ENTITY % $name.fpi.defined "IGNORE">\n}; |
| 250 |
|
} |
| 251 |
|
return <<EOH; |
| 252 |
|
@{[get_desc ($src, $Info, prefix => qq(%$name: ), |
| 253 |
|
padding_length => 51, padding_dot => q(.), |
| 254 |
|
default => qq(%$name)) |
| 255 |
|
]}$r |
| 256 |
|
<![%$name.fpi.defined;[ |
| 257 |
|
<!ENTITY % $name.decl |
| 258 |
|
\t'PUBLIC "%$name.fpi;" |
| 259 |
|
\t\t"%$name.sysid;"'> |
| 260 |
|
]]> |
| 261 |
|
<!ENTITY % $name.decl |
| 262 |
|
\t'SYSTEM "%$name.sysid;"'> |
| 263 |
|
<!ENTITY % $name %$name.decl;> |
| 264 |
|
<!-- @{[dot_padding qq<%$name >, length => 51, dot => q<.>]} --> |
| 265 |
|
EOH |
| 266 |
|
} else { |
| 267 |
|
my $s = get_desc ($src, $Info); |
| 268 |
|
$s .= qq{<!ENTITY % $name } . |
| 269 |
|
paralit $src->get_attribute_value ('EntityValue'); |
| 270 |
|
$s .= ">\n"; |
| 271 |
|
return $s; |
| 272 |
|
} |
| 273 |
|
} |
| 274 |
|
|
| 275 |
sub dtd_driver ($$) { |
sub dtd_driver ($$) { |
| 276 |
my ($src, $Info) = @_; |
my ($src, $Info) = @_; |
| 277 |
my $s = ''; |
my $s = ''; |
| 286 |
push @module_set, $src; |
push @module_set, $src; |
| 287 |
} elsif ($src->local_name =~ /^(?:QName|Attribute|Datatype|Notation)Module/) { |
} elsif ($src->local_name =~ /^(?:QName|Attribute|Datatype|Notation)Module/) { |
| 288 |
$s{$src->local_name} .= dtd_driver_load_module ($src, $Info); |
$s{$src->local_name} .= dtd_driver_load_module ($src, $Info); |
| 289 |
|
|
| 290 |
} elsif ($src->local_name eq 'IfModuleSet') { |
} elsif ($src->local_name eq 'IfModuleSet') { |
| 291 |
$s .= qq(<![%@{[$src->get_attribute_value ('ModuleSet')]}.module;[\n); |
my $ms = name_of $src, $Info, key => $src->get_attribute_value ('ID') ? |
| 292 |
|
'ID' : 'ModuleSet'; |
| 293 |
|
$s .= qq(<![%$ms.module;[\n); |
| 294 |
|
$s .= submodule_declarations ($src, $Info); |
| 295 |
|
$s .= qq(<!-- end of $ms -->]]>\n\n); |
| 296 |
|
|
| 297 |
|
} elsif ($src->local_name eq 'IfModule') { |
| 298 |
|
my $ms = name_of $src, $Info, key => 'ID'; |
| 299 |
|
$s .= qq(<![%$ms.module;[\n); |
| 300 |
$s .= submodule_declarations ($src, $Info); |
$s .= submodule_declarations ($src, $Info); |
| 301 |
$s .= qq(]]>\n); |
$s .= qq(<!-- end of $ms -->]]>\n\n); |
| 302 |
|
} elsif ($src->local_name eq 'ElementSwitch') { |
| 303 |
|
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.element "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
| 304 |
|
} elsif ($src->local_name eq 'AttributeSwitch') { |
| 305 |
|
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.attlist "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
| 306 |
|
} elsif ($src->local_name eq 'ModuleSwitch') { |
| 307 |
|
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.module "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
| 308 |
|
} elsif ($src->local_name eq 'Switch') { |
| 309 |
|
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]} "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
| 310 |
} elsif ($src->local_name eq 'GeneralEntity') { |
} elsif ($src->local_name eq 'GeneralEntity') { |
| 311 |
$s .= entity_declaration ($src, $Info, param => 0); |
$s .= entity_declaration ($src, $Info, param => 0); |
| 312 |
} elsif ($src->local_name eq 'ParameterEntity') { |
} elsif ($src->local_name eq 'ParameterEntity') { |
| 313 |
$s .= entity_declaration ($src, $Info, param => 1); |
$s .= parameter_entity_declaration ($src, $Info); |
| 314 |
} |
} |
| 315 |
} |
} |
| 316 |
|
|
| 373 |
]]> |
]]> |
| 374 |
<!ENTITY % $module_set->{ID}.xmlns.decl.attrib "">\n\n); |
<!ENTITY % $module_set->{ID}.xmlns.decl.attrib "">\n\n); |
| 375 |
} |
} |
| 376 |
|
$s .= <<EOH; |
| 377 |
|
<!-- Declare a parameter entity %XSI.prefix as a prefix to use for |
| 378 |
|
XML Schema Instance attributes. --> |
| 379 |
|
<!ENTITY % XSI.prefix "xsi"> |
| 380 |
|
|
| 381 |
|
<!ENTITY % XSI.pfx "%XSI.prefix;:"> |
| 382 |
|
|
| 383 |
|
<!ENTITY % XSI.xmlns "http://www.w3.org/2001/XMLSchema-instance"> |
| 384 |
|
|
| 385 |
|
<!-- Declare a parameter entity %XSI.xmlns.attrib as support for |
| 386 |
|
the schemaLocation attribute. --> |
| 387 |
|
<!ENTITY % XSI.xmlns.attrib |
| 388 |
|
"xmlns:%XSI.prefix; %URI.datatype; #FIXED '%XSI.xmlns;'"> |
| 389 |
|
EOH |
| 390 |
$s .= qq(\n<!ENTITY % NS.decl.attrib |
$s .= qq(\n<!ENTITY % NS.decl.attrib |
| 391 |
").join ("\n\t", (map {qq(%$_->{ID}.xmlns.decl.attrib;)} @src), |
").join ("\n\t", (map {qq(%$_->{ID}.xmlns.decl.attrib;)} @src), |
| 392 |
map {qq(%$_->{ID}.xmlns.extra.attrib;)} @src).qq(">\n); |
map {qq(%$_->{ID}.xmlns.extra.attrib;)} @src) |
| 393 |
|
.qq(\n\t%XSI.xmlns.attrib;">\n); |
| 394 |
$s .= qq(\n); |
$s .= qq(\n); |
| 395 |
for my $module_set (@src) { |
for my $module_set (@src) { |
| 396 |
$s .= qq(<!ENTITY % $module_set->{ID}.xmlns.attrib "%NS.decl.attrib;">\n); |
$s .= qq(<!ENTITY % $module_set->{ID}.xmlns.attrib "%NS.decl.attrib;">\n); |
| 489 |
my $ID = $Info->{ID}; |
my $ID = $Info->{ID}; |
| 490 |
my $ns = $src->get_attribute ('Namespace'); |
my $ns = $src->get_attribute ('Namespace'); |
| 491 |
my $s = <<EOH; |
my $s = <<EOH; |
| 492 |
|
<!ENTITY % sgml.tag.minimizable "IGNORE"> |
| 493 |
|
|
| 494 |
<!ENTITY % NS.prefixed "@{[$ns->get_attribute_value ('UsePrefix')==1? |
<!ENTITY % NS.prefixed "@{[$ns->get_attribute_value ('UsePrefix')==1? |
| 495 |
q(INCLUDE):q(IGNORE)]}"> |
q(INCLUDE):q(IGNORE)]}"> |
| 496 |
|
|
| 497 |
<!-- Section A: XML Namespace Framework :::::::::::::::::::::::::: --> |
<!-- Section A: XML Namespace Framework :::::::::::::::::::::::::: --> |
| 498 |
|
|
| 499 |
<!-- 1. Declare conditional section keyword, used to activate namespace |
<!-- 1. Declare a %$ID.prefixed; conditional section keyword, used |
| 500 |
prefixing. --> |
to activate namespace prefixing. --> |
| 501 |
<!ENTITY % $ID.prefixed "@{[$ns->get_attribute_value ('UsePrefix')==1? |
<!ENTITY % $ID.prefixed "@{[$ns->get_attribute_value ('UsePrefix')==1? |
| 502 |
q(INCLUDE): |
q(INCLUDE): |
| 503 |
$ns->get_attribute_value ('UsePrefix')==-1? |
$ns->get_attribute_value ('UsePrefix')==-1? |
| 504 |
q(IGNORE): |
q(IGNORE): |
| 505 |
q(%NS.prefixed;)]}"> |
q(%NS.prefixed;)]}"> |
| 506 |
|
|
| 507 |
<!-- 2. Declare a parameter entity containing the namespace name. --> |
<!ENTITY % $ID.global.attrs.prefixed "@{[$ns->get_attribute_value ('UsePrefix')==1? |
| 508 |
|
q(INCLUDE): |
| 509 |
|
$ns->get_attribute_value ('UsePrefix')==-1? |
| 510 |
|
q(IGNORE): |
| 511 |
|
q(%NS.prefixed;)]}"> |
| 512 |
|
|
| 513 |
|
<!ENTITY % $ID.xsi.attrs "INCLUDE"> |
| 514 |
|
|
| 515 |
|
<!-- 2. Declare a parameter entity %$ID.xmlns; containing |
| 516 |
|
the URI reference used to identity the namespace. --> |
| 517 |
<!ENTITY % $ID.xmlns "@{[$ns->get_attribute_value ('Name')]}"> |
<!ENTITY % $ID.xmlns "@{[$ns->get_attribute_value ('Name')]}"> |
| 518 |
|
|
| 519 |
<!-- 3. Declare parameter entities containing the default namespace prefix |
<!-- 3. Declare parameter entity %$ID.prefix; containing |
| 520 |
string to use when prefixing is enabled. --> |
the default namespace prefix string to use when prefixing |
| 521 |
|
is enabled. This may be overridden in the DTD driver or the |
| 522 |
|
internal subset of a document instance. |
| 523 |
|
|
| 524 |
|
NOTE: As specified in XML Namespace speficications, the namespace |
| 525 |
|
prefix serves as a proxy for the URI reference, and is not in itself |
| 526 |
|
significant. --> |
| 527 |
<!ENTITY % $ID.prefix "@{[$ns->get_attribute_value ('DefaultPrefix')]}"> |
<!ENTITY % $ID.prefix "@{[$ns->get_attribute_value ('DefaultPrefix')]}"> |
| 528 |
|
|
| 529 |
<!-- 4. Declare parameter entities containing the colonized prefix |
<!-- 4. Declare parameter entity %$ID.pfx; containing the |
| 530 |
used when prefixing is active, an empty string when it is not. --> |
colonized prefix (e.g, '%$ID.prefix;:') used when |
| 531 |
|
prefixing is active, an empty string when it is not. --> |
| 532 |
<![%$ID.prefixed;[ |
<![%$ID.prefixed;[ |
| 533 |
<!ENTITY % $ID.pfx "%$ID.prefix;:"> |
<!ENTITY % $ID.pfx "%$ID.prefix;:"> |
| 534 |
]]> |
]]> |
| 535 |
<!ENTITY % $ID.pfx ""> |
<!ENTITY % $ID.pfx ""> |
| 536 |
|
|
| 537 |
<!-- declare qualified name extensions here --> |
<!-- declare qualified name extensions here ............ --> |
| 538 |
<!ENTITY % ${ID}-qname-extra.mod ""> |
<!ENTITY % ${ID}-qname-extra.mod ""> |
| 539 |
%${ID}-qname-extra.mod; |
%${ID}-qname-extra.mod; |
| 540 |
|
|
| 541 |
<!-- 5. This parameter entity may be redeclared to contain any foreign |
<!-- 5. The parameter entity %$ID.xmlns.extra.attrib; may be |
| 542 |
namespace declaration attributes for namespaces embedded. --> |
redeclared to contain any foreign namespace declaration |
| 543 |
|
attributes for namespaces embedded. The default |
| 544 |
|
is an empty string. --> |
| 545 |
<!ENTITY % $ID.xmlns.extra.attrib ""> |
<!ENTITY % $ID.xmlns.extra.attrib ""> |
| 546 |
|
|
| 547 |
|
<!-- The parameter entity %URI.datatype; should already be defined in |
| 548 |
|
Datatype module. --> |
| 549 |
|
<!ENTITY % URI.datatype "CDATA"> |
| 550 |
|
|
| 551 |
<![%$ID.prefixed;[ |
<![%$ID.prefixed;[ |
| 552 |
<!ENTITY % $ID.xmlns.decl.attrib |
<!ENTITY % $ID.xmlns.decl.attrib |
| 553 |
"xmlns:%$ID.prefix; %URI.datatype; #FIXED '%$ID.xmlns;'"> |
"xmlns:%$ID.prefix; %URI.datatype; #FIXED '%$ID.xmlns;'"> |
| 555 |
<!ENTITY % $ID.xmlns.decl.attrib |
<!ENTITY % $ID.xmlns.decl.attrib |
| 556 |
"xmlns %URI.datatype; #FIXED '%$ID.xmlns;'"> |
"xmlns %URI.datatype; #FIXED '%$ID.xmlns;'"> |
| 557 |
|
|
| 558 |
|
<!-- Declare a parameter entity %XSI.prefix as a prefix to use for |
| 559 |
|
XML Schema Instance attributes. --> |
| 560 |
|
<!ENTITY % XSI.prefix "xsi"> |
| 561 |
|
|
| 562 |
|
<!ENTITY % XSI.pfx "%XSI.prefix;:"> |
| 563 |
|
|
| 564 |
|
<!ENTITY % XSI.xmlns "http://www.w3.org/2001/XMLSchema-instance"> |
| 565 |
|
|
| 566 |
|
<!-- Declare a parameter entity %XSI.xmlns.attrib as support for |
| 567 |
|
the schemaLocation attribute. --> |
| 568 |
|
<!ENTITY % XSI.xmlns.attrib |
| 569 |
|
"xmlns:%XSI.prefix; %URI.datatype; #FIXED '%XSI.xmlns;'"> |
| 570 |
|
|
| 571 |
<![%$ID.prefixed;[ |
<![%$ID.prefixed;[ |
| 572 |
<!ENTITY % NS.decl.attrib |
<!ENTITY % NS.decl.attrib |
| 573 |
"%$ID.xmlns.decl.attrib; |
"%$ID.xmlns.decl.attrib; |
| 574 |
%$ID.xmlns.extra.attrib;"> |
%$ID.xmlns.extra.attrib; |
| 575 |
|
%XSI.xmlns.attrib;"> |
| 576 |
]]> |
]]> |
| 577 |
<!ENTITY % NS.decl.attrib |
<!ENTITY % NS.decl.attrib |
| 578 |
"%$ID.xmlns.extra.attrib;"> |
"%$ID.xmlns.extra.attrib; |
| 579 |
|
%XSI.xmlns.attrib;"> |
| 580 |
|
|
| 581 |
<!-- Declare a parameter entity containing all XML namespace declaration |
<!-- Declare a parameter entity containing all XML namespace declaration |
| 582 |
attributes used, including a default xmlns declaration when prefixing |
attributes used, including a default xmlns declaration when prefixing |
| 589 |
"%$ID.xmlns.decl.attrib; |
"%$ID.xmlns.decl.attrib; |
| 590 |
%NS.decl.attrib;"> |
%NS.decl.attrib;"> |
| 591 |
|
|
| 592 |
<!-- Section B: Qualified Names :::::::::::::::::::::::::::::::::: --> |
<!-- @{[dot_padding qq(Section B: $Info->{realname} Qualified Names ), |
| 593 |
|
length => 71-9, dot => q(:)]} --> |
| 594 |
|
|
| 595 |
<!-- placeholder for qualified name redeclarations --> |
<!-- placeholder for qualified name redeclarations --> |
| 596 |
<!ENTITY % ${ID}-qname-extra.mod ""> |
<!ENTITY % ${ID}-qname.redecl ""> |
| 597 |
%${ID}-qname-extra.mod; |
%${ID}-qname.redecl; |
| 598 |
|
|
| 599 |
<!-- 6. Declare parameter entities used to provide namespace-qualified |
<!-- 6. This section declare parameter entities used to provide |
| 600 |
names for all element types and global attribute names. --> |
namespace-qualified names for all element types and global |
| 601 |
|
attribute names. --> |
| 602 |
EOH |
EOH |
| 603 |
for my $lname (sort keys %{$Info->{QName}}) { |
for my $lname (sort keys %{$Info->{QName}}) { |
| 604 |
$s .= qq(<!ENTITY % ) |
$s .= qq(<!ENTITY % ) |
| 682 |
|
|
| 683 |
sub get_desc ($$;%) { |
sub get_desc ($$;%) { |
| 684 |
my ($src, $Info, %opt) = @_; |
my ($src, $Info, %opt) = @_; |
| 685 |
my $desc = $src->get_attribute_value ('Description'); |
my $desc = $src->get_attribute_value ('Description'); |
| 686 |
$desc =~ s/\n/\n /g; |
$desc =~ s/--/- - /g; |
| 687 |
|
$desc =~ s/\n/\n /g; |
| 688 |
if (length $desc) { |
if (length $desc) { |
| 689 |
$desc = qq($opt{prefix}$desc); |
$desc = qq($opt{prefix}$desc); |
| 690 |
$desc .= q( ) if $opt{padding_length}; |
$desc .= q( ) if $opt{padding_length}; |
| 691 |
$desc = q(<!-- ).(dot_padding $desc, length => $opt{padding_length}, |
$desc = q(<!-- ).(dot_padding $desc, length => $opt{padding_length}, |
| 692 |
dot => $opt{padding_dot}).qq( -->\n); |
dot => $opt{padding_dot}).qq( -->\n); |
| 693 |
|
} elsif (length $opt{default}) { |
| 694 |
|
$desc = $opt{default}; |
| 695 |
|
$desc .= q( ) if $opt{padding_length}; |
| 696 |
|
$desc = q(<!-- ).(dot_padding $desc, length => $opt{padding_length}, |
| 697 |
|
dot => $opt{padding_dot}).qq( -->\n); |
| 698 |
} |
} |
| 699 |
$desc; |
$desc; |
| 700 |
} |
} |
| 774 |
'xml:base' => q<xml:base %URI.datatype; #IMPLIED>, |
'xml:base' => q<xml:base %URI.datatype; #IMPLIED>, |
| 775 |
'xml:lang' => q<xml:lang %LanguageCode.datatype; #IMPLIED>, |
'xml:lang' => q<xml:lang %LanguageCode.datatype; #IMPLIED>, |
| 776 |
'xml:space' => q<xml:space (default|preserve) #IMPLIED>, |
'xml:space' => q<xml:space (default|preserve) #IMPLIED>, |
| 777 |
|
'xsi:nil' => q<%XSI.prefix;:nil (true|false|1|0) #IMPLIED>, |
| 778 |
|
'xsi:noNamespaceSchemaLocation' => q<%XSI.prefix;:noNamespaceSchemaLocation CDATA #IMPLIED>, |
| 779 |
|
'xsi:schemaLocation' => q<%XSI.prefix;:schemaLocation CDATA #IMPLIED>, |
| 780 |
|
'xsi:type' => q<%XSI.prefix;:type NMTOKEN #IMPLIED>, |
| 781 |
}->{$src->value}; |
}->{$src->value}; |
| 782 |
} |
} |
| 783 |
|
|
| 803 |
} elsif ($src->local_name eq 'Content') { |
} elsif ($src->local_name eq 'Content') { |
| 804 |
$s .= element_content_def ($src, $Info); |
$s .= element_content_def ($src, $Info); |
| 805 |
} elsif ($src->local_name eq 'IfModuleSet') { |
} elsif ($src->local_name eq 'IfModuleSet') { |
| 806 |
$s .= qq(<![%@{[$src->get_attribute_value ('ModuleSet')]}.module;[\n); |
my $ms = name_of $src, $Info, key => $src->get_attribute_value ('ID') ? |
| 807 |
|
'ID' : 'ModuleSet'; |
| 808 |
|
$s .= qq(<![%$ms.module;[\n); |
| 809 |
|
$s .= submodule_declarations ($src, $Info); |
| 810 |
|
$s .= qq(<!-- end of $ms -->]]>\n\n); |
| 811 |
|
|
| 812 |
|
} elsif ($src->local_name eq 'IfModule') { |
| 813 |
|
my $ms = name_of $src, $Info, key => 'ID'; |
| 814 |
|
$s .= qq(<![%$ms.module;[\n); |
| 815 |
$s .= submodule_declarations ($src, $Info); |
$s .= submodule_declarations ($src, $Info); |
| 816 |
$s .= qq(<!-- end of -->]]>\n); |
$s .= qq(<!-- end of $ms -->]]>\n\n); |
| 817 |
} elsif ($src->local_name eq 'ElementSwitch') { |
} elsif ($src->local_name eq 'ElementSwitch') { |
| 818 |
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.element "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.element "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
| 819 |
} elsif ($src->local_name eq 'AttributeSwitch') { |
} elsif ($src->local_name eq 'AttributeSwitch') { |
| 820 |
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.attlist "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.attlist "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
| 821 |
} elsif ($src->local_name eq 'ModuleSwitch') { |
} elsif ($src->local_name eq 'ModuleSwitch') { |
| 822 |
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.module "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.module "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
| 823 |
|
} elsif ($src->local_name eq 'Switch') { |
| 824 |
|
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]} "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
| 825 |
} elsif ($src->local_name eq 'GeneralEntity') { |
} elsif ($src->local_name eq 'GeneralEntity') { |
| 826 |
$s .= entity_declaration ($src, $Info, param => 0); |
$s .= entity_declaration ($src, $Info, param => 0); |
| 827 |
} elsif ($src->local_name eq 'ParameterEntity') { |
} elsif ($src->local_name eq 'ParameterEntity') { |
| 828 |
$s .= entity_declaration ($src, $Info, param => 1); |
$s .= parameter_entity_declaration ($src, $Info); |
| 829 |
|
} elsif ($src->local_name eq 'Module') { |
| 830 |
|
$s .= dtd_driver_load_module ($src, $Info); |
| 831 |
|
} elsif ($src->local_name eq 'DTD') { |
| 832 |
|
$s .= dtd_driver_load_dtd ($src, $Info); |
| 833 |
} |
} |
| 834 |
} |
} |
| 835 |
$s; |
$s; |
| 851 |
$short_name = $1; |
$short_name = $1; |
| 852 |
} |
} |
| 853 |
my $s = get_desc $src, $Info, prefix => qq($short_name: ), |
my $s = get_desc $src, $Info, prefix => qq($short_name: ), |
| 854 |
padding_length => 51, padding_dot => q(.); |
padding_length => 51, padding_dot => q(.), |
| 855 |
|
default => qq($short_name); |
| 856 |
$s .= "\n"; |
$s .= "\n"; |
| 857 |
$s .= xml_parameter_ENTITY qq($mname.element), value => 'INCLUDE'; |
$s .= xml_parameter_ENTITY qq($mname.element), value => 'INCLUDE'; |
| 858 |
|
my $cm = convert_content_model ($src, $Info, default => 'EMPTY'); |
| 859 |
$s .= xml_condition_section (qq($mname.element) => |
$s .= xml_condition_section (qq($mname.element) => |
| 860 |
xml_parameter_ENTITY |
xml_parameter_ENTITY (qq($name.content), value => $cm) |
|
(qq($name.content), |
|
|
value => convert_content_model ($src, $Info, default => 'EMPTY')) |
|
| 861 |
. xml_parameter_ENTITY (qq($name.qname), value => $short_name) |
. xml_parameter_ENTITY (qq($name.qname), value => $short_name) |
| 862 |
. qq(<!ELEMENT %$name.qname; %$name.content;>\n)); |
. xml_parameter_ENTITY (qq($name.tagmin.start), value => q<->) |
| 863 |
|
. xml_parameter_ENTITY (qq($name.tagmin.end), value => $cm eq 'EMPTY' ? q<o> : q<->) |
| 864 |
|
. xml_condition_section (qq(sgml.tag.minimizable) => |
| 865 |
|
xml_parameter_ENTITY (qq($name.tagmin), |
| 866 |
|
value => qq"%$name.tagmin.start; %$name.tagmin.end;")) |
| 867 |
|
. xml_parameter_ENTITY (qq($name.tagmin), value => q"") |
| 868 |
|
. qq(<!ELEMENT %$name.qname; %$name.tagmin; %$name.content;>\n)); |
| 869 |
$s .= "\n"; |
$s .= "\n"; |
| 870 |
$s .= attlist_def (scalar $src->get_attribute ('Attribute', make_new_node => 1), $Info, $mname); |
$s .= attlist_def (scalar $src->get_attribute ('Attribute', make_new_node => 1), $Info, $mname); |
| 871 |
$s; |
$s; |
| 958 |
}]} --> |
}]} --> |
| 959 |
<!-- file: $Info->{ID}-$id.mod |
<!-- file: $Info->{ID}-$id.mod |
| 960 |
|
|
| 961 |
$Info->{Description} |
@{[make_paragraphs [$Info->{Description}], indent => q< >]} |
| 962 |
|
|
| 963 |
Copyright @{[(gmtime)[5]+1900]} $Info->{Copyright}, All Rights Reserved. |
Copyright @{[(gmtime)[5]+1900]} $Info->{Copyright}, All Rights Reserved. |
| 964 |
|
|
| 965 |
|
Permission to use, copy, modify and distribute this DTD and its |
| 966 |
|
accompanying documentation for any purpose and without fee is hereby |
| 967 |
|
granted in perpetuity, provided that the above copyright notice and |
| 968 |
|
this paragraph appear in all copies. The copyright holders make no |
| 969 |
|
representation about the suitability of the DTD for any purpose. |
| 970 |
|
|
| 971 |
|
It is provided "as is" without expressed or implied warranty. |
| 972 |
|
|
| 973 |
Revision: @{[sprintf '%04d-%02d-%02dT%02d:%02d:%02d+00:00', |
Revision: @{[sprintf '%04d-%02d-%02dT%02d:%02d:%02d+00:00', |
| 974 |
(gmtime)[5]+1900, (gmtime)[4]+1, (gmtime)[3,2,1,0] |
(gmtime)[5]+1900, (gmtime)[4]+1, (gmtime)[3,2,1,0] |
| 975 |
]} (Generated by $SCRIPT_NAME/$VERSION) |
]} (Generated by $SCRIPT_NAME/$VERSION) |
| 1030 |
}->{$id}, $src->get_attribute_value ('Description')); |
}->{$id}, $src->get_attribute_value ('Description')); |
| 1031 |
unshift @para, ' '.join ', ', sort @{$Info->{elements}||[]} if @{$Info->{elements}||[]}; |
unshift @para, ' '.join ', ', sort @{$Info->{elements}||[]} if @{$Info->{elements}||[]}; |
| 1032 |
if (@para) { |
if (@para) { |
| 1033 |
|
$name = qq($Info->{realname} QName (Qualified Name) Module) |
| 1034 |
|
if $id eq 'qname'; |
| 1035 |
$r .= <<EOH; |
$r .= <<EOH; |
| 1036 |
<!-- $name |
<!-- $name |
| 1037 |
|
|
| 1058 |
|
|
| 1059 |
my $r = <<EOH; |
my $r = <<EOH; |
| 1060 |
<!-- ....................................................................... --> |
<!-- ....................................................................... --> |
| 1061 |
<!-- @{[ dot_padding "$Info->{Name} DTD ", length => 71, dot => q(.) ]} --> |
<!-- @{[do{ |
| 1062 |
|
my $s = qq($Info->{Name} DTD ); |
| 1063 |
|
if (70 - length $s > 0) { |
| 1064 |
|
$s = dot_padding $s, length => 70, dot => q(.); |
| 1065 |
|
} else { |
| 1066 |
|
$s = qq( $Info->{Version} DTD ); |
| 1067 |
|
$s = qq($Info->{realname}\n ) . dot_padding $s, length => 70, dot => q(.); |
| 1068 |
|
} |
| 1069 |
|
$s; |
| 1070 |
|
}]} --> |
| 1071 |
<!-- file: $Info->{ID}.dtd |
<!-- file: $Info->{ID}.dtd |
| 1072 |
--> |
--> |
| 1073 |
|
|
| 1074 |
<!-- $Info->{Name} DTD |
<!-- $Info->{Name} DTD |
| 1075 |
|
|
| 1076 |
$Info->{Description} |
@{[make_paragraphs [$Info->{Description}], indent => q< >]} |
| 1077 |
|
|
| 1078 |
Copyright @{[(gmtime)[5]+1900]} $Info->{Copyright}, All Rights Reserved. |
Copyright @{[(gmtime)[5]+1900]} $Info->{Copyright}, All Rights Reserved. |
| 1079 |
|
|