173 |
'text/xml' => 1, |
'text/xml' => 1, |
174 |
'application/atom+xml' => 1, |
'application/atom+xml' => 1, |
175 |
'application/rss+xml' => 1, |
'application/rss+xml' => 1, |
176 |
'application/svg+xml' => 1, |
'image/svg+xml' => 1, |
177 |
'application/xhtml+xml' => 1, |
'application/xhtml+xml' => 1, |
178 |
'application/xml' => 1, |
'application/xml' => 1, |
179 |
|
## TODO: Should we make all XML MIME Types fall |
180 |
|
## into this category? |
181 |
|
|
182 |
|
'application/rdf+xml' => 1, ## NOTE: This type has different model. |
183 |
}->{$input->{media_type}}) { |
}->{$input->{media_type}}) { |
184 |
($doc, $el) = print_syntax_error_xml_section ($input, $result); |
($doc, $el) = print_syntax_error_xml_section ($input, $result); |
185 |
print_source_string_section ($input, |
print_source_string_section ($input, |
218 |
print_listing_section ({ |
print_listing_section ({ |
219 |
id => 'classes', label => 'Classes', heading => 'Classes', |
id => 'classes', label => 'Classes', heading => 'Classes', |
220 |
}, $input, $elements->{class}) if keys %{$elements->{class}}; |
}, $input, $elements->{class}) if keys %{$elements->{class}}; |
221 |
|
print_rdf_section ($input, $elements->{rdf}) if @{$elements->{rdf}}; |
222 |
} elsif (defined $cssom) { |
} elsif (defined $cssom) { |
223 |
print_structure_dump_cssom_section ($input, $cssom); |
print_structure_dump_cssom_section ($input, $cssom); |
224 |
## TODO: CSSOM validation |
## TODO: CSSOM validation |
1002 |
print STDOUT qq[</dl></div>]; |
print STDOUT qq[</dl></div>]; |
1003 |
} # print_listing_section |
} # print_listing_section |
1004 |
|
|
1005 |
|
sub print_rdf_section ($$$) { |
1006 |
|
my ($input, $rdfs) = @_; |
1007 |
|
|
1008 |
|
push @nav, ['#' . $input->{id_prefix} . 'rdf' => 'RDF'] |
1009 |
|
unless $input->{nested}; |
1010 |
|
print STDOUT qq[ |
1011 |
|
<div id="$input->{id_prefix}rdf" class="section"> |
1012 |
|
<h2>RDF Triples</h2> |
1013 |
|
|
1014 |
|
<dl>]; |
1015 |
|
my $i = 0; |
1016 |
|
for my $rdf (@$rdfs) { |
1017 |
|
print STDOUT qq[<dt id="$input->{id_prefix}rdf-@{[$i++]}">]; |
1018 |
|
print STDOUT get_node_link ($input, $rdf->[0]); |
1019 |
|
print STDOUT qq[<dd><dl>]; |
1020 |
|
for my $triple (@{$rdf->[1]}) { |
1021 |
|
print STDOUT '<dt>' . get_node_link ($input, $triple->[0]) . '<dd>'; |
1022 |
|
print STDOUT get_rdf_resource_html ($triple->[1]); |
1023 |
|
print STDOUT ' '; |
1024 |
|
print STDOUT get_rdf_resource_html ($triple->[2]); |
1025 |
|
print STDOUT ' '; |
1026 |
|
print STDOUT get_rdf_resource_html ($triple->[3]); |
1027 |
|
} |
1028 |
|
print STDOUT qq[</dl>]; |
1029 |
|
} |
1030 |
|
print STDOUT qq[</dl></div>]; |
1031 |
|
} # print_rdf_section |
1032 |
|
|
1033 |
|
sub get_rdf_resource_html ($) { |
1034 |
|
my $resource = shift; |
1035 |
|
if ($resource->{uri}) { |
1036 |
|
my $euri = htescape ($resource->{uri}); |
1037 |
|
return '<code class=uri><<a href="' . $euri . '">' . $euri . |
1038 |
|
'</a>></code>'; |
1039 |
|
} elsif ($resource->{bnodeid}) { |
1040 |
|
return htescape ('_:' . $resource->{bnodeid}); |
1041 |
|
} elsif ($resource->{nodes}) { |
1042 |
|
return '(rdf:XMLLiteral)'; |
1043 |
|
} elsif (defined $resource->{value}) { |
1044 |
|
my $elang = htescape (defined $resource->{language} |
1045 |
|
? $resource->{language} : ''); |
1046 |
|
my $r = qq[<q lang="$elang">] . htescape ($resource->{value}) . '</q>'; |
1047 |
|
if (defined $resource->{datatype}) { |
1048 |
|
my $euri = htescape ($resource->{datatype}); |
1049 |
|
$r .= '^^<code class=uri><<a href="' . $euri . '">' . $euri . |
1050 |
|
'</a>></code>'; |
1051 |
|
} elsif (length $resource->{language}) { |
1052 |
|
$r .= '@' . htescape ($resource->{language}); |
1053 |
|
} |
1054 |
|
return $r; |
1055 |
|
} else { |
1056 |
|
return '??'; |
1057 |
|
} |
1058 |
|
} # get_rdf_resource_html |
1059 |
|
|
1060 |
sub print_result_section ($) { |
sub print_result_section ($) { |
1061 |
my $result = shift; |
my $result = shift; |
1062 |
|
|