1 |
package Whatpm::ContentChecker; |
package Whatpm::ContentChecker; |
2 |
use strict; |
use strict; |
3 |
|
|
4 |
|
require Whatpm::URIChecker; |
5 |
|
|
6 |
## ISSUE: How XML and XML Namespaces conformance can (or cannot) |
## ISSUE: How XML and XML Namespaces conformance can (or cannot) |
7 |
## be applied to an in-memory representation (i.e. DOM)? |
## be applied to an in-memory representation (i.e. DOM)? |
8 |
|
|
36 |
$self->{onerror}->(node => $attr, |
$self->{onerror}->(node => $attr, |
37 |
type => 'syntax error'); |
type => 'syntax error'); |
38 |
} |
} |
39 |
## NOTE: Conformance to URI standard is not checked. |
## NOTE: Conformance to URI standard is not checked since there is |
40 |
|
## no author requirement on conformance in the XML Base specification. |
41 |
}, |
}, |
42 |
id => sub { |
id => sub { |
43 |
my ($self, $attr) = @_; |
my ($self, $attr) = @_; |
83 |
my ($self, $attr) = @_; |
my ($self, $attr) = @_; |
84 |
## TODO: In XML 1.0, URI reference [RFC 3986] or an empty string |
## TODO: In XML 1.0, URI reference [RFC 3986] or an empty string |
85 |
## TODO: In XML 1.1, IRI reference [RFC 3987] or an empty string |
## TODO: In XML 1.1, IRI reference [RFC 3987] or an empty string |
86 |
|
## TODO: relative references are deprecated |
87 |
my $value = $attr->value; |
my $value = $attr->value; |
88 |
if ($value eq $XML_NS) { |
if ($value eq $XML_NS) { |
89 |
$self->{onerror} |
$self->{onerror} |
664 |
} |
} |
665 |
}; # $HTMLUnorderedSetOfSpaceSeparatedTokensAttrChecker |
}; # $HTMLUnorderedSetOfSpaceSeparatedTokensAttrChecker |
666 |
|
|
667 |
|
## URI (or IRI) |
668 |
my $HTMLURIAttrChecker = sub { |
my $HTMLURIAttrChecker = sub { |
669 |
my ($self, $attr) = @_; |
my ($self, $attr) = @_; |
|
## TODO: URI or IRI check |
|
670 |
## ISSUE: Relative references are allowed? (RFC 3987 "IRI" is an absolute reference with optional fragment identifier.) |
## ISSUE: Relative references are allowed? (RFC 3987 "IRI" is an absolute reference with optional fragment identifier.) |
671 |
|
my $value = $attr->value; |
672 |
|
Whatpm::URIChecker->check_iri_reference ($value, sub { |
673 |
|
my %opt = @_; |
674 |
|
$self->{onerror}->(node => $attr, type => 'URI:'.$opt{level}.':'.$opt{type}); |
675 |
|
}); |
676 |
}; # $HTMLURIAttrChecker |
}; # $HTMLURIAttrChecker |
677 |
|
|
678 |
## A space separated list of one or more URIs (or IRIs) |
## A space separated list of one or more URIs (or IRIs) |