package XML::CompareML::DocBook; use strict; use warnings; =head1 NAME XML::CompareML::DocBook - convert CompareML to DocBook =head1 SYNOPSIS See L. =cut use XML::LibXML::Common qw(:w3c); use base 'XML::CompareML::Base'; sub _print_header { my $self = shift; my $o = $self->{o}; print {*{$o}} <<"EOF";
EOF } # Do Nothing sub _start_rendering { } # Do Nothing sub _finish_rendering { } sub _print_footer { my $self = shift; print {*{$self->{o}}} "
\n"; } sub _render_section_start { my $self = shift; my %args = (@_); my $depth = $args{depth}; my $id = $args{id}; my $title_string = $args{title_string}; my $expl = $args{expl}; my $sub_sections = $args{sub_sections}; if ($depth) { $self->_out("
\n"); } $self->_out("$title_string\n"); if ($depth == 0) { if (defined($self->_timestamp())) { $self->_out("" . $self->_timestamp() . "\n"); } } if ($expl) { $self->_out("\n" . $self->_xml_node_contents_to_string($expl) . "\n\n"); } } sub _render_sys_table_start { my ($self,%args) = @_; my $title_string = $args{title_string}; $self->_out(<<"EOF"); Comparison - $title_string System Description EOF } sub _html_to_docbook { my $parent_node = shift; my $not_first = shift; my @child_nodes = $parent_node->childNodes(); my $ret = ""; foreach my $node (@child_nodes) { if ($node->nodeType() == ELEMENT_NODE()) { if ($node->nodeName() eq "a") { $ret .= "getAttribute("href") . "\">"; } else { my @attrs = $node->attributes(); $ret .= "<" . $node->nodeName() . " " . join(" ", map { "$_=\"".$node->getAttribute($_)."\""} @attrs) . ">"; } $ret .= _html_to_docbook($node, 1); if ($node->nodeName() eq "a") { $ret .= ""; } else { $ret .= "nodeName() . ">"; } } else { $ret .= $node->toString(); } } # Remove leading and trailing space. if (1) { $ret =~ s!^\s+!!mg; $ret =~ s/\s+$//mg; } return $ret; } sub _render_s_elem { my ($self, $s_elem) = @_; return _html_to_docbook($s_elem); } sub _render_sys_table_row { my ($self, %args) = @_; $self->_out("\n" . $args{name}. "\n" . "\n" . $args{desc} . "\n\n\n"); } sub _render_sys_table_end { my $self = shift; $self->_out("\n\n
\n"); } sub _render_section_end { my ($self, %args) = @_; my $depth = $args{depth}; if ($depth) { $self->_out("
\n"); } } =head1 AUTHOR Shlomi Fish, L. =head1 SEE ALSO L =head1 COPYRIGHT AND LICENSE Copyright 2004, Shlomi Fish. All rights reserved. You can use, modify and distribute this module under the terms of the MIT X11 license. ( L ). =cut 1;