line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#============================================================= -*-perl-*- |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# XML::Schema::Element.pm |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# DESCRIPTION |
6
|
|
|
|
|
|
|
# Module implementing an object class for XML Schema elements. |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# AUTHOR |
9
|
|
|
|
|
|
|
# Andy Wardley |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# COPYRIGHT |
12
|
|
|
|
|
|
|
# Copyright (C) 2001 Canon Research Centre Europe Ltd. |
13
|
|
|
|
|
|
|
# All Rights Reserved. |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# This module is free software; you can redistribute it and/or |
16
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
# REVISION |
19
|
|
|
|
|
|
|
# $Id: Element.pm,v 1.1.1.1 2001/08/29 14:30:17 abw Exp $ |
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
#======================================================================== |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
package XML::Schema::Element; |
24
|
|
|
|
|
|
|
|
25
|
28
|
|
|
28
|
|
142
|
use strict; |
|
28
|
|
|
|
|
45
|
|
|
28
|
|
|
|
|
904
|
|
26
|
28
|
|
|
28
|
|
128
|
use XML::Schema; |
|
28
|
|
|
|
|
131
|
|
|
28
|
|
|
|
|
705
|
|
27
|
28
|
|
|
28
|
|
18193
|
use XML::Schema::Scoped; |
|
28
|
|
|
|
|
80
|
|
|
28
|
|
|
|
|
802
|
|
28
|
28
|
|
|
28
|
|
15543
|
use XML::Schema::Scheduler; |
|
28
|
|
|
|
|
112
|
|
|
28
|
|
|
|
|
997
|
|
29
|
28
|
|
|
28
|
|
159
|
use base qw( XML::Schema::Scoped XML::Schema::Scheduler ); |
|
28
|
|
|
|
|
51
|
|
|
28
|
|
|
|
|
3405
|
|
30
|
28
|
|
|
28
|
|
139
|
use vars qw( $VERSION $DEBUG $ERROR @MANDATORY @OPTIONAL @SCHEDULES ); |
|
28
|
|
|
|
|
46
|
|
|
28
|
|
|
|
|
10379
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$VERSION = sprintf("%d.%02d", q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/); |
33
|
|
|
|
|
|
|
$DEBUG = 0 unless defined $DEBUG; |
34
|
|
|
|
|
|
|
$ERROR = ''; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# mandatory 'type' implied by XML::Schema::Scoped base class |
37
|
|
|
|
|
|
|
@MANDATORY = qw( name ); |
38
|
|
|
|
|
|
|
# optional 'scope' implied by XML::Schema::Scoped base class |
39
|
|
|
|
|
|
|
@OPTIONAL = qw( namespace annotation ); |
40
|
|
|
|
|
|
|
@SCHEDULES = qw( start_element start_child end_child end_element text ); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
44
|
|
|
|
|
|
|
# init() |
45
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub init { |
48
|
11
|
|
|
11
|
1
|
25
|
my ($self, $config) = @_; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# call base class (XML::Schema::Scoped) initialiser |
51
|
11
|
50
|
|
|
|
78
|
$self->SUPER::init($config) |
52
|
|
|
|
|
|
|
|| return; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# call XML::Schema::Scheduler initialiser |
55
|
11
|
50
|
|
|
|
81
|
$self->init_scheduler($config) |
56
|
|
|
|
|
|
|
|| return; |
57
|
|
|
|
|
|
|
|
58
|
11
|
|
|
|
|
107
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
63
|
|
|
|
|
|
|
# name($newname) |
64
|
|
|
|
|
|
|
# |
65
|
|
|
|
|
|
|
# Accesor method to fetch (no arguments) or update (first argument) |
66
|
|
|
|
|
|
|
# element name. |
67
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub name { |
70
|
30
|
|
|
30
|
0
|
50
|
my $self = shift; |
71
|
30
|
100
|
|
|
|
186
|
return @_ ? ($self->{ name } = shift) : $self->{ name }; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
76
|
|
|
|
|
|
|
# handler($instance) |
77
|
|
|
|
|
|
|
# |
78
|
|
|
|
|
|
|
# Called |
79
|
|
|
|
|
|
|
#------------------------------------------------------------------------ |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub handler { |
82
|
0
|
|
|
0
|
0
|
|
my ($self, $instance) = @_; |
83
|
0
|
|
|
|
|
|
my $type = $self->type(); |
84
|
0
|
|
0
|
|
|
|
return $type->handler($instance, $self) |
85
|
|
|
|
|
|
|
|| $self->error($type->error()); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub present { |
89
|
0
|
|
|
0
|
0
|
|
my ($self, $view) = @_; |
90
|
0
|
|
|
|
|
|
$view->view( element => $self ); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub ID { |
94
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
95
|
0
|
|
|
|
|
|
return "Element[$self->{ name }]"; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |