| 35 |
$HTML_NS => {module => 'Whatpm::ContentChecker::HTML'}, |
$HTML_NS => {module => 'Whatpm::ContentChecker::HTML'}, |
| 36 |
$XML_NS => {loaded => 1}, |
$XML_NS => {loaded => 1}, |
| 37 |
$XMLNS_NS => {loaded => 1}, |
$XMLNS_NS => {loaded => 1}, |
| 38 |
|
q<http://www.w3.org/1999/02/22-rdf-syntax-ns#> => {loaded => 1}, |
| 39 |
}; |
}; |
| 40 |
|
|
| 41 |
our $AttrChecker = { |
our $AttrChecker = { |
| 235 |
|
|
| 236 |
our $Element = {}; |
our $Element = {}; |
| 237 |
|
|
| 238 |
|
$Element->{q<http://www.w3.org/1999/02/22-rdf-syntax-ns#>}->{RDF} = { |
| 239 |
|
%AnyChecker, |
| 240 |
|
status => FEATURE_STATUS_REC | FEATURE_ALLOWED, |
| 241 |
|
is_root => 1, ## ISSUE: Not explicitly allowed for non application/rdf+xml |
| 242 |
|
check_start => sub { |
| 243 |
|
my ($self, $item, $element_state) = @_; |
| 244 |
|
my $triple = []; |
| 245 |
|
push @{$self->{return}->{rdf}}, [$item->{node}, $triple]; |
| 246 |
|
require Whatpm::RDFXML; |
| 247 |
|
my $rdf = Whatpm::RDFXML->new; |
| 248 |
|
$rdf->{onerror} = $self->{onerror}; |
| 249 |
|
$rdf->{ontriple} = sub { |
| 250 |
|
my %opt = @_; |
| 251 |
|
push @$triple, |
| 252 |
|
[$opt{node}, $opt{subject}, $opt{predicate}, $opt{object}]; |
| 253 |
|
}; |
| 254 |
|
$rdf->convert_rdf_element ($item->{node}); |
| 255 |
|
}, |
| 256 |
|
}; |
| 257 |
|
|
| 258 |
sub check_document ($$$;$) { |
sub check_document ($$$;$) { |
| 259 |
my ($self, $doc, $onerror, $onsubdoc) = @_; |
my ($self, $doc, $onerror, $onsubdoc) = @_; |
| 260 |
$self = bless {}, $self unless ref $self; |
$self = bless {}, $self unless ref $self; |
| 270 |
$self->{info_level} = 'i'; |
$self->{info_level} = 'i'; |
| 271 |
$self->{unsupported_level} = 'u'; |
$self->{unsupported_level} = 'u'; |
| 272 |
|
|
| 273 |
|
## TODO: If application/rdf+xml, RDF/XML mode should be invoked. |
| 274 |
|
|
| 275 |
my $docel = $doc->document_element; |
my $docel = $doc->document_element; |
| 276 |
unless (defined $docel) { |
unless (defined $docel) { |
| 277 |
## ISSUE: Should we check content of Document node? |
## ISSUE: Should we check content of Document node? |
| 400 |
$self->{return} = { |
$self->{return} = { |
| 401 |
class => {}, |
class => {}, |
| 402 |
id => $self->{id}, table => [], term => $self->{term}, |
id => $self->{id}, table => [], term => $self->{term}, |
| 403 |
|
rdf => [], |
| 404 |
}; |
}; |
| 405 |
|
|
| 406 |
my @item = ({type => 'element', node => $el, parent_state => {}}); |
my @item = ({type => 'element', node => $el, parent_state => {}}); |