# -*- Perl -*- # dtdformat module for RefEntrys for DB:TDG my $VERSION = "SF DocBook 1.0"; my $PUBLIC_ID = "-//OASIS//DTD DocBook XML V4.5//EN"; my $SYSTEM_ID = "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"; my $prefix = ""; my @common_attributes = ('xml:base', 'wordsize', 'dir', 'id', 'role', 'lang', 'remap', 'xreflabel', 'revisionflag', 'arch', 'conformance', 'os', 'revision', 'userlevel', 'vendor', 'security', 'condition'); $fileext = ".xml"; $libdir = "/sourceforge/docbook/defguide/en/build/lib"; $config{'expanded-element-index'} = "elements"; $config{'unexpanded-element-index'} = "dtdelem"; $config{'expanded-entity-index'} = "entities"; $config{'unexpanded-entity-index'} = "dtdent"; $config{'expanded-entity-dir'} = 'paraments'; $config{'unexpanded-entity-dir'} = 'paraments'; $config{'notation-index'} = 'notations'; $option{'base-id'} = 'dbre'; $option{'base-dir'} = "$libdir/../../refpages"; $option{'seealso'} = 1; my %entity_classes = (); my @entity_classes = (); my @entity_pats = (); my %revision = ('productionset' => 'EBNF', 'production' => 'EBNF', 'lhs' => 'EBNF', 'rhs' => 'EBNF', 'nonterminal' => 'EBNF', 'constraint' => 'EBNF', 'productionrecap' => 'EBNF', 'constraintdef' => 'EBNF', 'bibliocoverage' => '4.2', 'biblioid' => '4.2', 'bibliorelation' => '4.2', 'bibliosource' => '4.2', 'blockinfo' => '4.2', 'citebiblioid' => '4.2', 'coref' => '4.2', 'errortext' => '4.2', 'personblurb' => '4.2', 'personname' => '4.2', 'refsection' => '4.2', 'refsectioninfo' => '4.2', 'textdata' => '4.2', 'appendixinfo' => '4.0', 'articleinfo' => '4.0', 'bibliographyinfo' => '4.0', 'chapterinfo' => '4.0', 'classsynopsis' => '4.0', 'classsynopsisinfo' => '4.0', 'constructorsynopsis' => '4.0', 'destructorsynopsis' => '4.0', 'exceptionname' => '4.0', 'fieldsynopsis' => '4.0', 'glossaryinfo' => '4.0', 'indexinfo' => '4.0', 'initializer' => '4.0', 'interfacename' => '4.0', 'methodname' => '4.0', 'methodparam' => '4.0', 'methodsynopsis' => '4.0', 'modifier' => '4.0', 'ooclass' => '4.0', 'ooexception' => '4.0', 'oointerface' => '4.0', 'partinfo' => '4.0', 'prefaceinfo' => '4.0', 'refentryinfo' => '4.0', 'referenceinfo' => '4.0', 'remark' => '4.0', 'revdescription' => '4.0', 'setindexinfo' => '4.0', 'sidebarinfo' => '4.0', 'simplemsgentry' => '4.0', 'mediaobject' => '3.1', 'mediaobjectco' => '3.1', 'inlinemediaobject' => '3.1', 'videoobject' => '3.1', 'audioobject' => '3.1', 'imageobject' => '3.1', 'imageobjectco' => '3.1', 'textobject' => '3.1', 'objectinfo' => '3.1', 'videodata' => '3.1', 'audiodata' => '3.1', 'imagedata' => '3.1', 'caption' => '3.1', 'informalfigure' => '3.1', 'colophon' => '3.1', 'section' => '3.1', 'sectioninfo' => '3.1', 'qandaset' => '3.1', 'qandadiv' => '3.1', 'qandaentry' => '3.1', 'question' => '3.1', 'answer' => '3.1', 'constant' => '3.1', 'varname' => '3.1'); # ====================================================================== { print "\nLoading parament classes..."; local *F, $_; my $class, $regexp; my %classes = (); open (F, "$libdir/parament.classes"); while () { chop; if (/^\s+(\S+)/) { $entity_classes{$1} = $class; } elsif (/^(\S+)\s+(\S+)/) { $class = $1; $regexp = $2; $regexp =~ s/\./\\\./g; $regexp =~ s/\*/\.\*/g; push(@entity_classes, $class); push(@entity_pats, $regexp); $classes{$class} = 1; } elsif (/^(\S+)\s*$/) { $class = $1; $classes{$class} = 1; } else { warn "Unexpected line in parament.classes: $_\n"; } } print "\nCleaning up parament class files..."; foreach $class (keys %classes) { my $basedir = $option{'base-dir'}; my $path = $basedir . "/" . $config{'expanded-entity-dir'}; unlink("$path/$class.e.gen"); $path = $basedir . "/" . $config{'unexpanded-entity-dir'}; unlink("$path/$class.u.gen"); } } END { # Now that we've written out all those parameter entity files, # make sure the entities in them are sorted... &status("Sorting entities...",1); my $basedir = $option{'base-dir'}; my $path = $basedir . "/" . $config{'expanded-entity-dir'}; opendir (DIR, $path); while (my $name = readdir(DIR)) { my $file = "$path/$name"; next if $name !~ /\.gen$/; next if -d $file; open (F, $file); read (F, $_, -s $file); close (F); my %refsects = (); while (/\s+/s) { my $sect = $&; my $id = $2; $_ = $` . $'; # ' die "Duplicate refsect ID: $2\n" if $refsects{$id}; $refsects{$id} = $sect; } die "Unexpected content in $file: $_\n" if !/^\s*$/s; open (F, ">$file"); foreach my $id (sort keys %refsects) { print F $refsects{$id}; } close (F); } closedir (DIR); print "\n"; } # ====================================================================== sub elementRefpurpose { my $count = shift; my $name = $elements[$count]; return "&$name.purpose;"; } sub entityRefpurpose { my $count = shift; my $name = $entities[$count]; my $entity = $entities{$name}; return "&$baseid.purp." . $entity->getAttribute('type') . "." . $name; } sub notationRefpurpose { my $count = shift; my $name = $notations[$count]; return "&$baseid.purp.notn.$name;"; } sub elementDescription { my $count = shift; my $name = $elements[$count]; my $desc = "$descdir/$name.sgm"; local $_; # return "&" . "desc.elem.$name;"; open (F, $desc); read (F, $_, -s $desc); close (F); return "\n" . $_; } sub entityDescription { my $count = shift; return "desc\n"; } sub notationDescription { my $count = shift; return "desc\n"; } # ====================================================================== sub basenames { my @names = @_; my %basename = (); my %usedname = (); foreach my $name (@names) { my $count = 2; my $bname = lc($name); if ($usedname{$bname}) { $bname = lc($name) . $count; while ($usedname{$bname}) { $bname++; } } $basename{$name} = $bname; $usedname{$name} = 1; } return %basename; } # ====================================================================== sub formatElement { my $count = shift; my $html = ""; my $name = $elements[$count]; my $element = $elements{$name}; my $cmex = undef; my $cmunx = undef; my $incl = undef; my $excl = undef; my $node = $element->getFirstChild(); while ($node) { if ($node->getNodeType() == XML::DOM::ELEMENT_NODE) { $cmex = $node if $node->getTagName() eq 'content-model-expanded'; $cmunx = $node if $node->getTagName() eq 'content-model'; $incl = $node if $node->getTagName() eq 'inclusions'; $excl = $node if $node->getTagName() eq 'exclusions'; } $node = $node->getNextSibling(); } $html .= &formatElementHeader($count); $html .= &formatElementTitle($count); if ($option{'synopsis'}) { if ($expanded eq 'expanded') { $html .= &formatElementSynopsis($count, $cmex, $cmex, $incl, $excl); } else { $html .= &formatElementSynopsis($count, $cmunx, $cmex, $incl, $excl); } } $html .= &formatElementDescription($count) if $option{'description'}; $html .= &formatElementAttrDescription($count) if $option{'attributes'}; $html .= &formatElementSeeAlso($count) if $option{'seealso'}; $html .= &formatElementExample($count) if $option{'examples'}; $html .= &formatElementFooter($count); } sub formatElementHeader { my $count = shift; my $html = ""; my $name = $elements[$count]; my $element = $elements{$name}; my $pub = "-//OASIS//DTD DocBook XML V4.2//EN"; my $sys = "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"; my $dir = $option{'base-dir'} . "/elements/$name"; if (! -d $dir) { mkdir($dir, 0755); } my $filename = "reference.e.xml"; my $rpub = "-//O'Reilly//ENTITIES DocBook RefPurposes V2.0//EN"; my $rsys = "../../../entities/refpurps.ent"; $html = ""; $html .= "\n"; $html .= "%refpurps.ent;\n"; $html .= "\n"; $html .= "%entities.ent;\n"; $html .= "\n"; $html .= "]>\n"; $html .= "$name Refentry\n"; $html .= "&refentry.xml;\n"; $html .= "\n"; if (! -f "$dir/$filename") { open (F, ">$dir/$filename"); print F $html; close (F); } $filename = "reference.u.xml"; $html = ""; $html .= "\n"; $html .= "%refpurps.ent;\n"; $html .= "\n"; $html .= "%entities.ent;\n"; $html .= "\n"; $html .= "]>\n"; $html .= "$name Refentry\n"; $html .= "&refentry.xml;\n"; $html .= "\n"; if (! -f "$dir/$filename") { open (F, ">$dir/$filename"); print F $html; close (F); } $html = ""; $html .= "\n\n"; return $html; } sub formatElementTitle { my $count = shift; my $name = $elements[$count]; my $element = $elements{$name}; my $html = ""; $html .= "\n"; $html .= "elements\n"; $html .= "" . $element->getAttribute('name') . "\n"; $html .= ""; $html .= $element->getAttribute('name'); $html .= "\n"; $html .= "Element\n"; $html .= "\n"; $html .= "\n"; $html .= "" . $element->getAttribute('name') . "\n"; $html .= ""; $html .= &elementRefpurpose($count); $html .= "\n"; $html .= "\n\n"; return $html; } sub formatElementSynopsis { my $count = shift; my $name = $elements[$count]; my $element = $elements{$name}; my $cm = shift; my $cmex = shift; my $incl = shift; my $excl = shift; my $html = ""; # What are the possibilities: mixed content, element content, or # declared content... my $mixed = $element->getAttribute('content-type') eq 'mixed'; my $declared = (!$mixed && $element->getAttribute('content-type') ne 'element'); $html .= "Synopsis\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "getAttribute('name') . " ::=\n"; $html .= &formatContentModel($count, $cm); $html .= "\n"; $html .= "\n"; $html .= &formatInclusions($count, $incl) if $incl && $option{'inclusions'}; $html .= &formatExclusions($count, $excl) if $excl && $option{'exclusions'}; $html .= &formatAttributeList($count) if $option{'attributes'}; $html .= &formatTagMinimization($count) if $option{'tag-minimization'}; $html .= &formatElementAppearsIn($count) if $option{'appears-in'}; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; my $dir = $option{'base-dir'} . "/elements/$name"; if (! -d $dir) { mkdir($dir, 0755); } my $filename = "synopsis"; if ($expanded eq 'expanded') { $filename .= ".e"; } else { $filename .= ".u"; } open (SYNOP, ">$dir/$prefix$filename.gen") || die "Can't open: $dir/$prefix$filename.gen: $!"; print SYNOP $html; close (SYNOP); $html = "&$name.synopsis.gen;\n"; return $html; } sub formatInclusions { my $count = shift; my $cm = shift; my $name = $elements[$count]; my $element = $elements{$name}; my $html = ""; # $html .= "\n"; $html .= "getElementsByTagName("attribute"); for (my $count = 0; $count < $attelem->getLength(); $count++) { my $attr = $attelem->item($count); my $name = $attr->getAttribute('name'); # print "Attr: $name\n"; $attrs{$name} = 1; if (exists $cmnatt{lc($name)}) { $cmnatt{lc($name)} = 1; } else { $uncommon = 1; } } foreach my $attr (keys %cmnatt) { if ($cmnatt{$attr} == 0) { # print "not common: $attr\n"; $common = 0; } } # print "Common? $common\n"; if ($common) { foreach my $attr (keys %attrs) { if (exists $cmnatt{lc($attr)}) { # print "Del: $attr\n"; delete $attrs{$attr}; } else { # print "Keep: $attr\n"; } } } } # $html .= "\n"; $html .= ""; # $html .= "Common attributes"; # $html .= ""; $html .= "Common attributes"; $html .= "\n"; } else { $html .= "\n"; } $html .= "\n"; if (defined($attlist) && ($uncommon || !$common)) { $html .= "\n"; $html .= "getElementsByTagName("attribute"); my $last = ""; # figure out the last; have to do it this way because we may # skip some attributes, possibly the one that's last in the # actual list. for (my $count = 0; $count < $attrs->getLength(); $count++) { my $attr = $attrs->item($count); my $name = $attr->getAttribute('name'); next if !exists $atthash{$name}; $last = $name; } for (my $count = 0; $count < $attrs->getLength(); $count++) { my $attr = $attrs->item($count); my $name = $attr->getAttribute('name'); my $type = $attr->getAttribute('value'); my $decltype = $attr->getAttribute('type'); my $default = ""; next if !exists $atthash{$name}; if ($decltype eq '#IMPLIED') { $default = "None"; } elsif ($decltype eq '#REQUIRED') { $default = "Required"; } elsif ($decltype eq '#CONREF') { $default = "Content reference"; } else { $default = $attr->getAttribute('default'); if ($default =~ /\"/) { $default = "'" . $default . "'"; } else { $default = "\"" . $default . "\""; } } if ($decltype eq '#FIXED') { $default = $default . " (fixed)"; } if ($name eq $last) { $html .= "\n"; } else { $html .= "\n"; } $html .= &formatCell($name); $html .= &formatValues($type, $attr); $html .= &formatCell($default); $html .= "\n"; } return $html; } sub formatCell { my $value = shift; return "$value\n"; } sub formatValues { my $values = shift; my $attr = shift; my $enum = $attr->getAttribute('enumeration'); my $html = ""; if ($enum eq 'no' || $enum eq '') { return &formatCell($values); } $html .= ""; # if ($enum eq 'notation') { # $html .= "Enumerated notation:\n"; # } else { # $html .= "Enumeration:\n"; # } # # $html .= "\n"; $html .= "getAttribute('value'))) { $html .= "$val\n"; } $html .= "\n"; return $html; } sub formatTagMinimization { my $count = shift; my $name = $elements[$count]; my $element = $elements{$name}; my $html = ""; my $stagm = $element->getAttribute('stagm') || "-"; my $etagm = $element->getAttribute('etagm') || "-"; if ($element->getAttribute('stagm') || $element->getAttribute('etagm')) { my (%min) = ('--' => "Both the start- and end-tags are required for this element.", 'OO' => "Both the start- and end-tags are optional for this element, if your SGML declaration allows tag minimization.", 'O-' => "The start-tag is optional for this element, if your SGML declaration allows tag minimization. The end-tag is required.", '-O' => "The start-tag is required for this element. The end-tag is optional, if your SGML declaration allows minimization." ); # $html .= "\n"; $html .= "getAttribute('name'); $html .= ""; $html .= "\n"; } else { $html .= "\n"; } } $html .= "\n"; } # $html .= "]]>\n"; } return $html; } sub formatElementDescription { my $count = shift; my $name = $elements[$count]; my $element = $elements{$name}; my $desc = &elementDescription($count); my $html = ""; $html = "Description Processing expectations \n\n"; $html .= &formatParents($count); $html .= &formatChildren($count); $html .= "\n\n\n"; return $html; } sub formatParents { my $count = shift; my $name = $elements[$count]; my $element = $elements{$name}; my $html = ""; if (exists $PARENTS{$name}) { $html .= "Parents\n"; $html .= "These elements contain "; $html .= $element->getAttribute('name') . ":\n"; $html .= ""; my $pname; foreach $pname (sort { uc($a) cmp uc($b) } keys %{$PARENTS{$name}}) { my $child = $elements{$pname}; $html .= ""; # $html .= ""; $html .= "" . $child->getAttribute('name') . ""; # $html .= ""; $html .= "\n"; } $html .= ".\n"; $html .= "\n"; my $dir = $option{'base-dir'} . "/elements/$name"; if (! -d $dir) { mkdir($dir, 0755); } my $filename = "parents"; if ($expanded eq 'expanded') { open (PAR, ">$dir/$prefix$filename.gen") || die "Can't open: $dir/$prefix$filename.gen: $!"; print PAR $html; close (PAR); } else { # unexpanded is exactly the same } $html = "&$name.parents.gen;\n"; } return $html; } sub formatChildren { my $count = shift; my $name = $elements[$count]; my $element = $elements{$name}; my $html = ""; my $mixed = $element->getAttribute('content-type') eq 'mixed'; my $declared = (!$mixed && $element->getAttribute('content-type') ne 'element'); return "" if $declared; # can't be any children... if (exists $CHILDREN{$name} || exists $POSSINCL{$name} || exists $POSSEXCL{$name}) { $html .= "Children\n"; } if (exists $CHILDREN{$name}) { $html .= "The following elements occur in "; $html .= $element->getAttribute('name') . ":\n"; $html .= ""; my $cname; foreach $cname (sort { uc($a) cmp uc($b) } keys %{$CHILDREN{$name}}) { my $child = $elements{$cname}; die "Unexpected error (1): can't find element \"$cname\".\n" if !$child; $html .= ""; # $html .= ""; $html .= ""; $html .= $child->getAttribute('name'); $html .= ""; # $html .= ""; $html .= "\n"; } $html .= ".\n"; } if (exists $POSSINCL{$name}) { $html .= "In some contexts, the following elements are\n"; $html .= "allowed anywhere:\n"; $html .= "\n"; my $cname; foreach $cname (sort { uc($a) cmp uc($b) } keys %{$POSSINCL{$name}}) { my $child = $elements{$cname}; die "Unexpected error (2): can't find element \"$cname\".\n" if !$child; $html .= ""; # $html .= ""; $html .= ""; $html .= $child->getAttribute('name'); $html .= ""; # $html .= ""; $html .= "\n"; } $html .= ".\n\n"; } if (exists $POSSEXCL{$name}) { $html .= "In some contexts, the following elements are\n"; $html .= "excluded:\n"; $html .= "\n"; my $cname; foreach $cname (sort { uc($a) cmp uc($b) } keys %{$POSSEXCL{$name}}) { my $element = $elements{$cname}; $html .= ""; # $html .= ""; $html .= ""; $html .= $element->getAttribute('name'); $html .= ""; # $html .= ""; $html .= "\n"; } $html .= ".\n\n"; } if (exists $CHILDREN{$name} || exists $POSSINCL{$name} || exists $POSSEXCL{$name}) { $html .= "\n"; my $dir = $option{'base-dir'} . "/elements/$name"; if (! -d $dir) { mkdir($dir, 0755); } my $filename = "children"; if ($expanded eq 'expanded') { open (CHD, ">$dir/$prefix$filename.gen") || die "Can't open: $dir/$prefix$filename.gen: $!"; print CHD $html; close (CHD); } else { # unexpanded is exactly the same } $html = "&$name.children.gen;\n"; } return $html; } sub formatElementAttrDescription { my $count = shift; my $name = $elements[$count]; my $html = ""; my $attlist = $attlists{$name}; my %attrs = (); my %cmnatt = ('id' => 0, 'role' => 0, 'lang' => 0, 'remap'=> 0, 'xreflabel' => 0, 'revisionflag' => 0, 'arch' => 0, 'conformance' => 0, 'os' => 0, 'revision' => 0, 'userlevel' => 0, 'vendor' => 0, 'security' => 0, 'condition' => 0); # Check for DocBook common attributes if (defined($attlist)) { my $attelem = $attlist->getElementsByTagName("attribute"); for (my $count = 0; $count < $attelem->getLength(); $count++) { my $attr = $attelem->item($count); my $name = $attr->getAttribute('name'); $attrs{$name} = 1 if !defined($cmnatt{lc($name)}); } } return $html if !%attrs; $html .= "Attributes\n"; $html .= "\n"; foreach $attr (sort keys %attrs) { my $desc = "attr." . lc($attr) . ".$name"; $html .= "$attr\n"; $html .= "\n"; $html .= "&$desc;\n"; $html .= "\n"; $html .= "\n"; } $html .= "\n"; $html .= "\n"; return $html; } my %SeeAlso = (); sub formatElementSeeAlso { my $count = shift; my $name = $elements[$count]; my @group = (); my $html = ""; if (!%SeeAlso) { my $ingroup = 0; open (F, "$libdir/seealso") || die "Failed to open: $libdir/seealso\n"; while () { chop; if (/^\s+(\S+)/) { push(@group, lc($1)); $ingroup = 1; } if (/^\S/ && $ingroup) { $ingroup = 0; foreach my $elem (@group) { $SeeAlso{$elem} = {} if ! exists $SeeAlso{$elem}; foreach my $grelem (@group) { $SeeAlso{$elem}->{$grelem} = 1; } } @group = (); } if (/^\S/) { $title = $_; } } close (F); } @group = (); foreach my $grelem (sort keys %{$SeeAlso{$name}}) { push (@group, $grelem) unless $name eq $grelem; } if (@group) { $html .= ""; $html .= "\n"; foreach my $elem (@group) { my $element = $elements{$elem}; $html .= ""; # $html .= ""; $html .= ""; if ($element) { $html .= $element->getAttribute('name'); } else { print STDERR "No element $elem in formatElementSeeAlso???\n"; $html .= "???"; } $html .= ""; # $html .= ""; $html .= "\n"; } $html .= ".\n\n"; my $dir = $option{'base-dir'} . "/elements/$name"; if (! -d $dir) { mkdir($dir, 0755); } my $filename = "seealso"; if ($expanded eq 'expanded') { open (SEE, ">$dir/$prefix$filename.gen") || die "Can't open: $dir/$prefix$filename.gen: $!"; print SEE $html; close (SEE); } else { # unexpanded is exactly the same } $html = "See Also\n"; $html .= "&$name.seealso.gen;\n"; $html .= "\n"; } return $html; } sub formatElementExample { my $count = shift; my $name = $elements[$count]; my $element = $elements{$name}; my $examplehead = "Examples\n\n"; my $examplefoot = "\n"; my $see = ""; my $example = ""; my $done = 0; my $excount = 1; my %format = ( 'blockquote' => 1, 'caution' => 1, 'cmdsynopsis' => 1, 'equation' => 1, 'example' => 1, 'figure' => 1, 'formalpara' => 1, 'funcsynopsis' => 1, 'glosslist' => 1, 'important' => 1, 'informalexample' => 1, 'informalfigure' => 1, 'informaltable' => 1, 'itemizedlist' => 1, 'mediaobject' => 1, 'mediaobjectco' => 1, 'msgset' => 1, 'note' => 1, 'orderedlist' => 1, 'para' => 1, 'procedure' => 1, 'programlistingco' => 1, 'qandaset' => 1, 'screen' => 1, 'screenshot' => 1, 'segmentedlist' => 1, 'simpara' => 1, 'simplelist' => 1, 'synopsis' => 1, 'table' => 1, 'tip' => 1, 'variablelist' => 1, 'warning' => 1, ); local *F, $_; # this really just makes .txt and .gen versions of the files my $dir = $option{'base-dir'} . "/elements/$name"; if (! -d $dir) { mkdir($dir, 0755); } while (!$done) { $done = 1; my $filename = "$dir/example.$excount"; $file = "$filename.xml"; if (open (F, $file)) { read (F, $_, -s $file); close (F); #$_ .= "\n" if substr($_, length($_), 1) ne "\n"; my $doctype = ""; if (/(]+\[.*?\]\>\s*)(.*)$/s) { $doctype = $1; $_ = $2; } elsif (/(]+>\s*)(.*)$/s) { $doctype = $1; $_ = $2; } else { warn "No doctype declaration on $filename?\n"; } my $tag = $1 if /^[^<]*<([a-zA-Z0-9]+)/s; open (EX, ">$filename.txt") || die "Can't open: $filename.txt: $!"; my $text = $doctype . $_; $text =~ s/\&/\&/sg; $text =~ s/\/\>/sg; print EX $text; close (EX); if ($format{lc($tag)}) { open (EX,">$filename.gen") || die "Can't open: $filename.gen $!"; print EX $_; close (EX); } $done = 0; } $excount++; } $excount -= 2; # yes, two. because of the way that loop works. my $html = ""; if ($excount > 0) { $html .= "\nExamples\n\n"; for (my $count = 1; $count <= $excount; $count++) { $html .= "\n"; $html .= "&$name.example.$count.txt;\n"; $html .= "\n\n"; $html .= "\n"; $html .= "&$name.example.$count.gen;\n"; $html .= "\n\n"; $html .= "\n\n"; } } return $html; } sub formatElementFooter { my $count = shift; my $html = ""; $html .= "\n\n"; return $html; } # ---------------------------------------------------------------------- my $state = 'NONE'; my $depth = 0; my $col = 0; sub formatContentModel { my $count = shift; my $cm = shift; my $node = $cm->getFirstChild(); my $html = ""; $state = "NONE"; $depth = 0; $col = 0; while ($node) { if ($node->getNodeType == XML::DOM::ELEMENT_NODE) { $html .= formatContentModelElement($node); } $node = $node->getNextSibling(); } return $html; } sub formatContentModelElement { my $node = shift; my $html = ""; if ($node->getNodeType == XML::DOM::ELEMENT_NODE) { 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); } else { die "Unexpected node: \"" . $node->getTagName() . "\"\n"; } $node = $node->getNextSibling(); } else { die "Unexpected node type.\n"; } return $html; } sub formatCMGroup { my $group = shift; my $occur = $group->getAttribute('occurrence'); ;my $sep = shift; my $first = 1; my $html = ""; if ($state ne 'NONE' && $state ne 'OPEN') { $html .= "\n"; $html .= " " x $depth if $depth > 0; $col = $depth; $state = 'NEWLINE'; } $html .= "("; $state = 'OPEN'; $depth++; $col++; my $node = $group->getFirstChild(); while ($node) { if ($node->getNodeType() == XML::DOM::ELEMENT_NODE) { if (!$first) { my $name = $node->getAttribute('name'); my $occur = $node->getAttribute('occurrence'); $html .= $sep; $col++; if ($state ne 'NEWLINE' && ($col + length($name) + length($occur) > 65)) { $html .= "\n"; $html .= " " x $depth if $depth > 0; $col = $depth; $state = 'NEWLINE'; } } $html .= &formatContentModelElement($node); $first = 0; } $node = $node->getNextSibling(); } $html .= ")"; $col++; if ($occur) { $html .= $occur; $col++; } $state = 'CLOSE'; $depth--; return $html; } sub formatCMElement { my $element = shift; my $name = $element->getAttribute('name'); my $occur = $element->getAttribute('occurrence'); my $html = ""; $name = lc($name) if !$option{'case-sensitive'}; if ($state eq 'CLOSE') { $html .= "\n"; $html .= " " x $depth if $depth > 0; $col = $depth; $state = 'NEWLINE'; } # $html .= ""; $html .= ""; $html .= $element->getAttribute('name'); $html .= ""; # $html .= ""; $col += length($name); if ($occur) { $html .= $occur; $col++; } $state = 'ELEMENT'; return $html; } sub formatCMParament { my $element = shift; my $name = $element->getAttribute('name'); my $html = ""; if ($state eq 'CLOSE') { $html .= "\n"; $html .= " " x $depth if $depth > 0; $col = $depth; $state = 'NEWLINE'; } # $html .= ""; $html .= ""; $html .= $name; $html .= ""; # $html .= ""; $col += length($name) + 2; $state = 'PARAMENT'; return $html; } sub formatCMPCDATA { my $html = ""; $html .= "#PCDATA"; $col += 7; $state = 'PCDATA'; return $html; } sub formatCMCDATA { my $html = ""; $html .= "CDATA"; $col += 5; $state = 'CDATA'; return $html; } sub formatCMRCDATA { my $html = ""; $html .= "RCDATA"; $col += 5; $state = 'RCDATA'; return $html; } sub formatCMEMPTY { my $html = ""; $html .= "EMPTY"; $col += 5; $state = 'EMPTY'; return $html; } # ====================================================================== sub formatEntity { my $count = shift; my $name = $entities[$count]; my $entity = $entities{$name}; my $html = ""; my $textnl, $altnl; if ($expanded eq 'expanded') { $textnl = $entity->getElementsByTagName("text-expanded"); $altnl = $entity->getElementsByTagName("text"); } else { $textnl = $entity->getElementsByTagName("text"); $altnl = $entity->getElementsByTagName("text-expanded"); } # Hack; we're appending to a single file, just return the VLE synopsis... return &formatEntityVLESynopsis($count, $textnl, $altnl); $html .= &formatEntityHeader($count); $html .= &formatEntityTitle($count); $html .= &formatEntitySynopsis($count, $textnl, $altnl) if $option{'synopsis'}; $html .= &formatEntityAppearsIn($count) if $option{'appears-in'}; $html .= &formatEntityDescription($count) if $option{'description'}; $html .= &formatEntityExamples($count) if $option{'examples'}; $html .= &formatEntityFooter($count); return $html; } sub formatEntityHeader { my $count = shift; my $html = ""; my $name = $entities[$count]; $html .= "\n"; $html .= "\n"; $html .= "\n\n"; return $html; } sub formatEntityTitle { my $count = shift; my $name = $entities[$count]; my $entity = $entities{$name}; my $type = $entity->getAttribute("type"); my $html = ""; # $html .= "\n"; $html .= ""; $html .= $entity->getAttribute('name'); $html .= "\n"; if ($type eq 'gen') { $html .= "General Entity\n"; } else { $html .= "Parameter Entity\n"; } $html .= "\n"; # $html .= "]]>\n\n"; $html .= "\n"; $html .= "" . $entity->getAttribute('name') . "\n"; $html .= ""; $html .= &entityRefpurpose($count); $html .= "\n"; $html .= "\n\n"; } sub formatEntitySynopsis { my $count = shift; my $textnl = shift; my $altnl = shift; my $name = $entities[$count]; my $entity = $entities{$name}; my $html = ""; my $type = $entity->getAttribute("type"); my $public = $entity->getAttribute("public"); my $system = $entity->getAttribute("system"); my $text = ""; if ($textnl->getLength() > 0) { my $textnode = $textnl->item(0); my $content = $textnode->getFirstChild(); if ($content) { $text = $content->getData(); } else { $text = ""; } } # $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "getLength() > 0) { my $textnode = $altnl->item(0); my $content = $textnode->getFirstChild(); if ($content) { $text = $content->getData(); } else { $text = ""; } } $html .= "\n"; $html .= "getAttribute("type"); my $public = $entity->getAttribute("public"); my $system = $entity->getAttribute("system"); my $text = ""; my %attr = (); if ($textnl->getLength() > 0) { my $textnode = $textnl->item(0); my $content = $textnode->getFirstChild(); if ($content) { $text = $content->getData(); } else { $text = ""; } } $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "\n"; $html .= "getLength() > 0) { my $textnode = $altnl->item(0); my $content = $textnode->getFirstChild(); if ($content) { $text = $content->getData(); } else { $text = ""; } } $html .= "\n"; $html .= " 0, 'role' => 0, 'lang' => 0, 'remap'=> 0, 'xreflabel' => 0, 'revisionflag' => 0, 'arch' => 0, 'conformance' => 0, 'os' => 0, 'revision' => 0, 'userlevel' => 0, 'vendor' => 0, 'security' => 0, 'condition' => 0); # This function is only called if $text is not empty. # Interpret it as a well-formed section of an attlist decl $text =~ s/--.*?--//sg; # $html .= "\n"; $html .= "\n"; $html .= "Name\n"; $html .= "Type\n"; $html .= "Default\n"; $html .= "\n"; $text =~ s/\n/ /sg; # make it all one line.. while ($text !~ /^\s*$/) { $html .= "\n"; $text =~ /^\s*(\S+)(.*?)$/; my $token = $1; $text = $2; $attrs{$token} = 1 if !defined($cmnatt{lc($token)}); $html .= "$token\n"; $text =~ /^\s*(\S+)(.*?)$/; $token = $1; $text = $2; if ($token =~ /NOTATION/ || $token =~ /^\s*\(/) { $html .= ""; if ($token =~ /NOTATION/) { $html .= "Enumerated notation:"; $text =~ /^\s*(\S+)\s+(.*)$/; $token = $1; $text = $2; } else { $html .= "Enumerated:"; } $html .= ""; if ($token =~ /\)\s*$/) { # we got the whole thing... } else { $text =~ /^(.*?)\)/; $token .= $1; $text = $'; # ' } $token =~ s/[\(\)\|]/ /sg; $token =~ s/^\s*//sg; $token =~ s/\s*$//sg; my @members = split(/\s+/, $token); foreach my $member (@members) { $html .= "$member\n"; } $html .= "\n"; } else { $html .= "$token\n"; } $text =~ /^\s*(\S+)(.*?)$/s; $token = $1; $text = $2; if ($token eq '#IMPLIED') { $token = "None"; } elsif ($token eq '#REQUIRED') { $token = "Required"; } elsif ($token eq '#CONREF') { $token = "Content reference"; } $html .= "$token\n"; $html .= "\n"; } return ($html, %attrs); } sub formatEntityAttributeDesc { my $name = shift; my %attrs = @_; my $html = ""; # find an element that uses entity %name if (!defined($EAPPEARSIN{"%$name"})) { print "No EA for %$name\n"; return $html; } my %elem = %{$EAPPEARSIN{"%$name"}}; my @elems = keys %elem; my $elemname = $elems[0]; $html .= "Attribute descriptions:"; $html .= "\n"; $html .= "\n"; foreach my $attr (sort keys %attrs) { $html .= "$attr\n"; $html .= "\n"; $html .= "&attr." . lc($attr) . ".$elemname;\n"; $html .= "\n"; $html .= "\n"; } $html .= "\n"; return $html; } sub formatEntityVLEAppearsIn { my $name = shift; my $html = ""; my %appears = %{$EAPPEARSIN{"%$name"}} if exists $EAPPEARSIN{"%$name"}; if (%appears) { my @ents = sort { uc($a) cmp uc($b) } keys %appears; $html .= "\n"; $html .= "getAttribute('name'); $html .= ""; $html .= "\n"; } else { $html .= "\n"; } } $html .= "\n"; } } return $html; } sub formatEntitySynopsisContent { my $text = shift; my $html = ""; # OK, it's a parameter entity. Now, does it look like a # content model fragment my $cmfragment = &cmFragment($text); while ($text =~ /\%?[-a-z0-9.:_]+;?/is) { my $pre = $`; my $match = $&; $text = $'; # ' $html .= $pre; if ($pre =~ /\#$/) { # if it comes after a '#', it's a keyword... $html .= $match; next; } if ($match =~ /\%([^;]+);?/) { $name = $1; if (exists $entities{$name}) { # $html .= ""; $html .= $match; # $html .= ""; } else { $html .= $match; } } elsif ($cmfragment) { $name = $match; $name = lc($name) if !$option{'case-sensitive'}; if (exists $elements{$name}) { my $linkend = "$baseid.elem.$name"; # $html .= ""; $html .= "$match"; # $html .= ""; } else { $html .= $match; } } else { $html .= $match; } } return $html; } sub formatEntityAppearsIn { my $count = shift; my $html = ""; my $entityname = $entities[$count]; my $entity = $entities{$entityname}; my %appears = (); my $key = "%$entityname"; if (exists $APPEARSIN{$key}) { %appears = %{$APPEARSIN{$key}}; my @ents = sort { uc($a) cmp uc($b) } keys %appears; # $html .= "Parameter Entities\n"; $html .= "The following parameter entities contain "; $html .= ""; $html .= $entity->getAttribute('name'); $html .= ":\n"; $html .= "\n"; for (my $count = 0; $count <= $#ents; $count++) { my $entity = $entities{$ents[$count]}; $html .= ""; # $html .= "getAttribute('type') . "."; # $html .= $entity->getAttribute('name') . "\">"; $html .= ""; $html .= $entity->getAttribute('name'); $html .= ""; # $html .= ""; $html .= "\n"; } $html .= "\n"; $html .= "\n"; # $html .= "]]>\n\n"; } my $refsect = "refsect1"; if (exists($EAPPEARSIN{$key}) && exists($XAPPEARSIN{$key})) { $refsect = "refsect2"; # $html .= "Elements\n"; $html .= "Some element content models are effected both\n"; $html .= "directly and indirectly by the\n"; $html .= ""; $html .= $entity->getAttribute('name'); $html .= " parameter entity.\n"; } if (exists($EAPPEARSIN{$key})) { %appears = %{$EAPPEARSIN{$key}}; my @elem = sort { uc($a) cmp uc($b) } keys %appears; if (exists($EAPPEARSIN{$key}) && exists($XAPPEARSIN{$key})) { $html .= "Directly Effected\n"; # print "\n", $entity->getAttribute('name'), " ($key):\n"; # print "\t", $#elem, "\n"; # foreach my $foo (keys %{$EAPPEARSIN{$key}}) { # print "\t'$foo'='", $EAPPEARSIN{$key}->{$foo}, "'\n"; # } } else { $html .= "Elements\n"; } $html .= "The content models of the following elements\n"; $html .= "contain "; $html .= ""; $html .= $entity->getAttribute('name'); $html .= " directly:\n"; $html .= "\n"; for (my $count = 0; $count <= $#elem; $count++) { my $element = $elements{$elem[$count]}; $html .= ""; # $html .= ""; $html .= ""; $html .= $element->getAttribute('name'); $html .= ""; # $html .= ""; $html .= "\n"; } $html .= "\n"; $html .= "\n"; } if (exists $XAPPEARSIN{$key}) { %appears = %{$XAPPEARSIN{$key}}; my @elem = sort { uc($a) cmp uc($b) } keys %appears; if (exists($EAPPEARSIN{$key}) && exists($XAPPEARSIN{$key})) { $html .= "Indirectly Effected\n"; } else { $html .= "Elements\n"; } $html .= "The content models of the following elements\n"; $html .= "contain "; $html .= ""; $html .= $entity->getAttribute('name'); $html .= " indirectly:\n"; $html .= "\n"; for (my $count = 0; $count <= $#elem; $count++) { my $element = $elements{$elem[$count]}; $html .= ""; # $html .= ""; $html .= ""; $html .= $element->getAttribute('name'); $html .= ""; # $html .= ""; $html .= "\n"; } $html .= "\n"; $html .= "\n"; } $html .= "\n" if (exists($EAPPEARSIN{$key}) && exists($XAPPEARSIN{$key})); # $html .= "]]>\n\n"; return $html; } sub formatEntityDescription { my $count = shift; my $name = $entities[$count]; my $entity = $entities{$name}; my $desc = &entityDescription($count); my $html = ""; return "" if !defined($desc); $html .= "Description\n"; $html .= $desc; $html .= "\n\n"; return $html; } sub formatEntityExamples { my $count = shift; my $name = $entities[$count]; my $entity = $entities{$name}; return ""; } sub formatEntityFooter { my $count = shift; my $html = ""; $html .= "\n"; return $html; } # ====================================================================== sub formatNotation { my $count = shift; my $html = ""; my $name = $notations[$count]; my $element = $notations{$name}; $html .= &formatNotationHeader($count); $html .= &formatNotationTitle($count); if ($option{'synopsis'}) { $html .= &formatNotationSynopsis($count); } $html .= &formatNotationDescription($count) if $option{'description'}; $html .= &formatNotationExamples($count) if $option{'examples'}; $html .= &formatNotationFooter($count); } sub formatNotationHeader { my $count = shift; my $html = ""; my $name = $notations[$count]; $html .= "\n"; $html .= "\n"; $html .= "\n\n"; return $html; } sub formatNotationTitle { my $count = shift; my $name = $notations[$count]; my $notation = $notations{$name}; my $html = ""; $html .= "\n"; $html .= ""; $html .= $notation->getAttribute('name'); $html .= "\n"; $html .= "Notation\n"; $html .= "\n\n"; $html .= "\n"; $html .= "" . $notation->getAttribute('name') . "\n"; $html .= ""; $html .= ¬ationRefpurpose($count); $html .= "\n"; $html .= "\n\n"; } sub formatNotationSynopsis { my $count = shift; my $name = $notations[$count]; my $notation = $notations{$name}; my $html = ""; my $public = $notation->getAttribute("public"); my $system = $notation->getAttribute("system"); $html .= "\n"; if ($public) { $html .= "\nPublic identifier:\n"; $html .= "$public."; $html .= "\n\n"; } if ($system) { $html .= "\nSystem identifier:\n"; $html .= "$system."; $html .= "\n\n"; } if (!$public && !$system) { $html .= "\nSystem specified\n"; $html .= "without a system identifier."; $html .= "\n\n"; } return $html; } sub formatNotationDescription { my $count = shift; my $name = $notations[$count]; my $notation = $notations{$name}; my $desc = ¬ationDescription($count); my $html = ""; return "" if !defined($desc); $html .= "Description\n"; $html .= $desc; $html .= "\n\n"; return $html; } sub formatNotationExamples { my $count = shift; my $name = $notations[$count]; my $element = $notations{$name}; return ""; } sub formatNotationFooter { my $count = shift; my $html = ""; $html .= "\n"; return $html; } # ====================================================================== sub createDir { my $dir = shift; my $mode = shift; # nop } sub checkDir { my $dir = shift; # nop } sub writeElement { my $count = shift; my $path = shift; my $basename = shift; my $fileext = shift; my $html = shift; my $name = $elements[$count]; my $element = $elements{$name}; my $dir = $option{'base-dir'} . "/elements/$basename"; if (! -d $dir) { mkdir($dir, 0755); } # DON'T OVERWRITE THIS FILE ANYMORE! if (! -f "$dir/refentry$fileext") { open (F, ">$dir/refentry$fileext"); print F $html; close (F); } open (F, ">$dir/${prefix}entities.e.ent"); print F "\n" if -f "$dir/${prefix}synopsis.e.gen"; foreach my $f ("children", "parents", "seealso", "example.seealso") { print F "\n" if -f "$dir/$prefix$f.gen"; } for (my $count = 1; -f "$dir/example.$count.gen"; $count++) { print F "\n"; } for (my $count = 1; -f "$dir/example.$count.txt"; $count++) { print F "\n"; } close (F); open (F, ">$dir/${prefix}entities.u.ent"); print F "\n" if -f "$dir/${prefix}synopsis.u.gen"; foreach my $f ("children", "parents", "seealso", "example.seealso") { print F "\n" if -f "$dir/$prefix$f.gen"; } for (my $count = 1; -f "$dir/example.$count.gen"; $count++) { print F "\n"; } for (my $count = 1; -f "$dir/example.$count.txt"; $count++) { print F "\n"; } close (F); } sub writeEntity { my $count = shift; my $path = shift; my $basename = shift; my $fileext = shift; my $html = shift; my $name = $entities[$count]; my $entity = $entities{$name}; my $class = $entity_classes{$name}; # Hack; actually append a subset of the entity to a single file... if (!defined($class)) { for (my $cnt = 0; $cnt <= $#entity_classes; $cnt++) { if ($name =~ /$entity_pats[$cnt]/) { $class = $entity_classes[$cnt]; last; } } } if ($class ne '') { my $bdir = $option{'base-dir'}; my $edir = $config{$expanded . '-entity-dir'}; my $ext = "e.gen"; my $entdir = "$bdir/$edir"; my $bid = $option{'base-id'}; local *F; if ($expanded ne 'expanded') { $ext = "u.gen"; } if ($class ne 'isochars') { open (F, ">>$entdir/$class.$ext"); print F ""; print F "%$name;\n"; print F $html; print F "\n\n"; close (F); } } else { print "No class defined for entity $name\n"; } } sub writeNotation { my $count = shift; my $path = shift; my $basename = shift; my $fileext = shift; my $html = shift; # No, we're not writing individual notation pages. # But thanks for asking. } sub writeElementIndexes { my $basedir = shift; my $title = $dtd->getDocumentElement->getAttribute('title'); my ($entfile, $sgmfile, $sysdir); local (*F, $_); return; $entfile = $basedir . "/" . $config{$expanded . "-element-index"} . ".ent"; $sgmfile = $basedir . "/" . $config{$expanded . "-element-index"} . ".sgm"; $sysdir = $config{$expanded . "-element-dir"}; open (F, ">$entfile"); foreach $name (@elements) { my $basename = $ELEMBASE{$name}; print F "\n"; print F "\n"; } close (F); open (F, ">$sgmfile"); print F "$title Element Reference\n"; foreach $name (@elements) { print F "&$baseid.elem.$name;\n"; } print F "\n"; close (F); } sub writeEntityIndexes { my $basedir = shift; my $title = $dtd->getDocumentElement->getAttribute('title'); my ($entfile, $sgmfile, $sysdir); local (*F, $_); return; $entfile = $basedir . "/" . $config{$expanded . "-entity-index"} . ".ent"; $sgmfile = $basedir . "/" . $config{$expanded . "-entity-index"} . ".sgm"; $sysdir = $config{$expanded . "-entity-dir"}; open (F, ">$entfile"); foreach $name (@entities) { my $entity = $entities{$name}; my $basename = $ENTBASE{$name}; print F "\n"; print F "getAttribute('type'), ".$name \"purpose\">\n"; } close (F); open (F, ">$sgmfile"); print F "$title Entity Reference\n"; foreach $name (@entities) { print F "&$baseid.param.$name;\n"; } print F "\n"; close (F); } sub writeNotationIndexes { my $basedir = shift; my $basedir = $option{'base-dir'}; my $path = $basedir . "/" . $config{'notation-dir'}; local (*F, $_); # hack. write the notation .gen file instead of a proper index $notnfile = "$path/notations.gen"; open (F, ">$notnfile"); foreach $name (sort @notations) { $notation = $notations{$name}; print F "\n"; print F "$name\n"; print F "\n"; print F "Public id: "; if ($notation->getAttribute('public') ne '') { print F ""; print F $notation->getAttribute('public'); print F "\n"; } else { print F "undefined\n"; } print F "\n"; print F "System id: "; if ($notation->getAttribute('system') ne '') { print F ""; print F $notation->getAttribute('system'); print F "\n"; } else { print F "undefined\n"; } print F "\n"; print F "\n"; print F "\n"; } close (F); } sub writeIndex { my $basedir = shift; my $title = $dtd->getDocumentElement->getAttribute('title'); my $entfile = $config{"expanded-entity-index"}; my $elemfile = $config{"expanded-element-index"}; my $notfile = $config{"notation-index"}; my $root = $dtd->getDocumentElement(); my $elements = $root->getElementsByTagName('element'); my $entities = $root->getElementsByTagName('entity'); my $notations = $root->getElementsByTagName('notation'); my $elemcount = $elements->getLength(); my $entcount = $entities->getLength(); my $notcount = $notations->getLength(); local (*F, $_); return; open (F, ">" . $basedir . "/" . $config{'home'}); print F "\n\n$title\n"; print F "\n\n"; print F "

$title

\n"; print F "[Elements]\n"; print F "[Entities]\n"; print F "[Notations]\n"; print F "
\n"; print F "

"; print F "The $title "; print F "DTD " if $title !~ / DTD$/i; print F "is composed of $elemcount elements, "; if ($entcount == 0) { print F "no entities, "; } elsif ($entcount == 1) { print F "1 entity, "; } else { print F "$entcount entities, "; } print F "and "; if ($notcount == 0) { print F "no notations.\n"; } elsif ($notcount == 1) { print F "1 notation.\n"; } else { print F "$notcount notations.\n"; } my %etypes = (); for (my $count = 0; $count < $entities->getLength(); $count++) { my $ent = $entities->item($count); my $type = &entityType($ent); $etypes{$type} = 0 if !exists($etypes{$type}); $etypes{$type}++; } print F "

\n"; print F "It "; if ($root->getAttribute('public-id')) { print F "has the public identifier \""; print F $root->getAttribute('public-id'); print F "\" and "; } print F "claims to be an "; if ($root->getAttribute('xml')) { print F "XML"; } else { print F "SGML"; } print F " DTD. Element "; print F "and notation " if $notcount > 0; print F "names are "; print F "not " if $root->getAttribute('namecase-general'); print F "case sensitive. Entity names are "; print F "not " if $root->getAttribute('namecase-entity'); print F "case sensitive.\n"; print F "

\n"; print F "
\n"; print F "HTML Presentation of "; print F $dtd->getDocumentElement->getAttribute('title'); print F " by "; print F "DTDParse\n"; print F "\n"; print F "\n"; close (F); } 1;