Mercurial > pub > Impl
comparison Lib/IMPL/DOM/Schema/NodeList.pm @ 236:2904da230022
DOM refactoring
author | sergey |
---|---|
date | Mon, 15 Oct 2012 04:23:01 +0400 |
parents | d1676be8afcc |
children | b8c724f6de36 |
comparison
equal
deleted
inserted
replaced
235:a4d9126edcbb | 236:2904da230022 |
---|---|
36 foreach my $child ( @{$node->childNodes} ) { | 36 foreach my $child ( @{$node->childNodes} ) { |
37 #skip schema elements | 37 #skip schema elements |
38 while ($info and not $info->{anyNode} and $info->{nodeName} ne $child->nodeName) { | 38 while ($info and not $info->{anyNode} and $info->{nodeName} ne $child->nodeName) { |
39 # if possible of course :) | 39 # if possible of course :) |
40 return new IMPL::DOM::Schema::ValidationError ( | 40 return new IMPL::DOM::Schema::ValidationError ( |
41 Message => $this->messageUnexpected, | 41 message => $this->messageUnexpected, |
42 Node => $child, | 42 node => $child, |
43 Parent => $node, | 43 parent => $node, |
44 Schema => $info->{Schema}, | 44 schema => $info->{Schema}, |
45 Source => $sourceSchema | 45 source => $sourceSchema |
46 ) if $info->{Min} > $info->{Seen}; | 46 ) if $info->{Min} > $info->{Seen}; |
47 | 47 |
48 $info = shift @nodes; | 48 $info = shift @nodes; |
49 } | 49 } |
50 | 50 |
51 # return error if no more children allowed | 51 # return error if no more children allowed |
52 return new IMPL::DOM::Schema::ValidationError ( | 52 return new IMPL::DOM::Schema::ValidationError ( |
53 Message => $this->messageUnexpected, | 53 message => $this->messageUnexpected, |
54 Node => $child, | 54 node => $child, |
55 Parent => $node, | 55 parent => $node, |
56 Source => $sourceSchema | 56 source => $sourceSchema |
57 ) unless $info; | 57 ) unless $info; |
58 | 58 |
59 # it's ok, we found schema element for child | 59 # it's ok, we found schema element for child |
60 # but it may be any node or switching node wich would not satisfy current child | 60 # but it may be any node or switching node wich would not satisfy current child |
61 | 61 |
70 | 70 |
71 $info->{Seen}++; | 71 $info->{Seen}++; |
72 | 72 |
73 # check count limits | 73 # check count limits |
74 return new IMPL::DOM::Schema::ValidationError ( | 74 return new IMPL::DOM::Schema::ValidationError ( |
75 Error => 1, | 75 message => $this->messageUnexpected, |
76 Message => $this->messageUnexpected, | 76 node => $child, |
77 Node => $child, | 77 parent => $node, |
78 Parent => $node, | 78 source => $sourceSchema, |
79 Source => $sourceSchema, | |
80 ) if $info->{Max} and $info->{Seen} > $info->{Max}; | 79 ) if $info->{Max} and $info->{Seen} > $info->{Max}; |
81 } | 80 } |
82 | 81 |
83 # no more children left (but may be should :) | 82 # no more children left (but may be should :) |
84 while ($info) { | 83 while ($info) { |
85 return new IMPL::DOM::Schema::ValidationError ( | 84 return new IMPL::DOM::Schema::ValidationError ( |
86 Error => 1, | 85 error => 1, |
87 Message => $this->messageNodesRequired, | 86 message => $this->messageNodesRequired, |
88 Source => $sourceSchema, | 87 source => $sourceSchema, |
89 Parent => $node, | 88 parent => $node, |
90 Schema => $info->{Schema} | 89 schema => $info->{Schema} |
91 ) if $info->{Seen} < $info->{Min}; | 90 ) if $info->{Seen} < $info->{Min}; |
92 | 91 |
93 $info = shift @nodes; | 92 $info = shift @nodes; |
94 } | 93 } |
95 return; | 94 return; |