| 121 |
## no author requirement on conformance in the XML Base specification. |
## no author requirement on conformance in the XML Base specification. |
| 122 |
}, |
}, |
| 123 |
id => sub { |
id => sub { |
| 124 |
my ($self, $attr) = @_; |
my ($self, $attr, $item, $element_state) = @_; |
| 125 |
my $value = $attr->value; |
my $value = $attr->value; |
| 126 |
$value =~ s/[\x09\x0A\x0D\x20]+/ /g; |
$value =~ s/[\x09\x0A\x0D\x20]+/ /g; |
| 127 |
$value =~ s/^\x20//; |
$value =~ s/^\x20//; |
| 135 |
push @{$self->{id}->{$value}}, $attr; |
push @{$self->{id}->{$value}}, $attr; |
| 136 |
} else { |
} else { |
| 137 |
$self->{id}->{$value} = [$attr]; |
$self->{id}->{$value} = [$attr]; |
| 138 |
|
$self->{id_type}->{$value} = $element_state->{id_type} || ''; |
| 139 |
} |
} |
| 140 |
}, |
}, |
| 141 |
}, |
}, |
| 221 |
## TODO: xsi:schemaLocation for XHTML2 support (very, very low priority) |
## TODO: xsi:schemaLocation for XHTML2 support (very, very low priority) |
| 222 |
|
|
| 223 |
our %AnyChecker = ( |
our %AnyChecker = ( |
| 224 |
|
## NOTE: |check_start| is invoked before anything on the element's |
| 225 |
|
## attributes and contents is checked. |
| 226 |
check_start => sub { }, |
check_start => sub { }, |
| 227 |
|
## NOTE: |check_attrs| is invoked after |check_start| and before |
| 228 |
|
## anything on the element's contents is checked. |
| 229 |
check_attrs => sub { |
check_attrs => sub { |
| 230 |
my ($self, $item, $element_state) = @_; |
my ($self, $item, $element_state) = @_; |
| 231 |
for my $attr (@{$item->{node}->attributes}) { |
for my $attr (@{$item->{node}->attributes}) { |
| 260 |
$self->_attr_status_info ($attr, $status); |
$self->_attr_status_info ($attr, $status); |
| 261 |
} |
} |
| 262 |
}, |
}, |
| 263 |
|
## NOTE: |check_child_element| is invoked for each occurence of |
| 264 |
|
## child elements. It is invoked after |check_attrs| and before |
| 265 |
|
## |check_end|. |check_child_element| and |check_child_text| are |
| 266 |
|
## invoked for each child elements and text nodes in tree order. |
| 267 |
check_child_element => sub { |
check_child_element => sub { |
| 268 |
my ($self, $item, $child_el, $child_nsuri, $child_ln, |
my ($self, $item, $child_el, $child_nsuri, $child_ln, |
| 269 |
$child_is_transparent, $element_state) = @_; |
$child_is_transparent, $element_state) = @_; |
| 277 |
# |
# |
| 278 |
} |
} |
| 279 |
}, |
}, |
| 280 |
|
## NOTE: |check_child_text| is invoked for each occurence of child |
| 281 |
|
## text nodes. It is invoked after |check_attrs| and before |
| 282 |
|
## |check_end|. |check_child_element| and |check_child_text| are |
| 283 |
|
## invoked for each child elements and text nodes in tree order. |
| 284 |
check_child_text => sub { }, |
check_child_text => sub { }, |
| 285 |
|
## NOTE: |check_end| is invoked after everything on the element's |
| 286 |
|
## attributes and contents are checked. |
| 287 |
check_end => sub { |
check_end => sub { |
| 288 |
my ($self, $item, $element_state) = @_; |
my ($self, $item, $element_state) = @_; |
| 289 |
## NOTE: There is a modified copy of the code below for |html:ruby|. |
## NOTE: There is a modified copy of the code below for |html:ruby|. |
| 573 |
$self->{plus_elements} = {}; |
$self->{plus_elements} = {}; |
| 574 |
$self->{minus_elements} = {}; |
$self->{minus_elements} = {}; |
| 575 |
$self->{id} = {}; |
$self->{id} = {}; |
| 576 |
$self->{form} = {}; |
$self->{id_type} = {}; # 'form' / 'labelable' / 'menu' |
| 577 |
|
$self->{form} = {}; # form/@name |
| 578 |
|
$self->{idref} = []; # @form, @for, @contextmenu |
| 579 |
$self->{term} = {}; |
$self->{term} = {}; |
| 580 |
$self->{usemap} = []; |
$self->{usemap} = []; |
| 581 |
$self->{ref} = []; # datetemplate data references |
$self->{ref} = []; # datetemplate data references |
| 582 |
$self->{template} = []; # datatemplate template references |
$self->{template} = []; # datatemplate template references |
|
$self->{contextmenu} = []; |
|
| 583 |
$self->{map} = {}; |
$self->{map} = {}; |
|
$self->{menu} = {}; |
|
| 584 |
$self->{has_link_type} = {}; |
$self->{has_link_type} = {}; |
| 585 |
$self->{flag} = {}; |
$self->{flag} = {}; |
| 586 |
#$self->{has_uri_attr}; |
#$self->{has_uri_attr}; |
| 792 |
} |
} |
| 793 |
} |
} |
| 794 |
|
|
| 795 |
for (@{$self->{contextmenu}}) { |
for (@{$self->{idref}}) { |
| 796 |
unless ($self->{menu}->{$_->[0]}) { |
if ($self->{id}->{$_->[1]} and |
| 797 |
$self->{onerror}->(node => $_->[1], type => 'no referenced menu', |
$self->{id_type}->{$_->[1]} eq $_->[0]) { |
| 798 |
|
# |
| 799 |
|
} else { |
| 800 |
|
$self->{onerror}->(node => $_->[2], |
| 801 |
|
type => { |
| 802 |
|
form => 'no referenced form', |
| 803 |
|
labelable => 'no referenced control', |
| 804 |
|
menu => 'no referenced menu', |
| 805 |
|
}->{$_->[0]}, |
| 806 |
level => $self->{level}->{must}); |
level => $self->{level}->{must}); |
| 807 |
} |
} |
| 808 |
} |
} |
| 811 |
delete $self->{minus_elements}; |
delete $self->{minus_elements}; |
| 812 |
delete $self->{onerror}; |
delete $self->{onerror}; |
| 813 |
delete $self->{id}; |
delete $self->{id}; |
| 814 |
|
delete $self->{id_type}; |
| 815 |
delete $self->{form}; |
delete $self->{form}; |
| 816 |
|
delete $self->{idref}; |
| 817 |
delete $self->{usemap}; |
delete $self->{usemap}; |
| 818 |
delete $self->{ref}; |
delete $self->{ref}; |
| 819 |
delete $self->{template}; |
delete $self->{template}; |