# HG changeset patch # User cin # Date 1392066400 -14400 # Node ID 4bdf155e5bfe4464e392c77d9a08f1cb52d4805b # Parent 0d63f5273307e3128d24f1068137acf3553f95cb# Parent 4edd360250511eee2945937df53f4e2e1e63e076 Слияние diff -r 0d63f5273307 -r 4bdf155e5bfe Lib/IMPL/DOM/Navigator/Builder.pm --- a/Lib/IMPL/DOM/Navigator/Builder.pm Tue Feb 11 01:05:55 2014 +0400 +++ b/Lib/IMPL/DOM/Navigator/Builder.pm Tue Feb 11 01:06:40 2014 +0400 @@ -13,7 +13,6 @@ BEGIN { private _direct property _schemaNavi => PROP_RW; private _direct property _docClass => PROP_RW; - public _direct property BuildErrors => PROP_RO | PROP_LIST; public _direct property Document => PROP_RO; public _direct property ignoreUndefined => PROP_RO; } @@ -34,15 +33,13 @@ sub NavigateCreate { my ($this,$nodeName,%props) = @_; - if (my $schemaNode = $this->{$_schemaNavi}->NavigateName($nodeName)) { - my $class = $schemaNode->can('nativeType') ? $schemaNode->nativeType || 'IMPL::DOM::Node' : 'IMPL::DOM::Node'; - - my $schemaSource = $this->{$_schemaNavi}->SourceSchemaNode; + if (my $schemaType = $this->{$_schemaNavi}->NavigateName($nodeName)) { + my $class = $schemaType->can('nativeType') ? $schemaType->nativeType || 'IMPL::DOM::Node' : 'IMPL::DOM::Node'; - my @errors = $this->inflateProperties($schemaNode,\%props); - - $props{schema} = $schemaNode; - $props{schemaSource} = $schemaSource; + my $schemaNode = $this->{$_schemaNavi}->SourceSchemaNode; + + $props{schemaType} = $schemaType; + $props{schemaNode} = $schemaNode; my $node; if (! $this->{$Document}) { @@ -57,20 +54,6 @@ $this->internalNavigateNodeSet($node); } - if (@errors) { - $this->BuildErrors->Append( - map { - IMPL::DOM::Schema::ValidationError->new( - node => $node, - source => $schemaSource, - schema => $schemaNode, - message => $schemaNode->messageInflateError, - error => $_ - ) - } @errors - ); - } - return $node; } else { die new IMPL::InvalidOperationException("The specified node is undefined", $nodeName) @@ -79,44 +62,6 @@ } } -sub inflateProperties { - my ($this,$schemaNode,$refProps) = @_; - my @errors; - foreach my $schemaProp ( $schemaNode->selectNodes('Property') ) { - next if not exists $refProps->{$schemaProp->name}; - my $result = eval {$schemaProp->inflateValue($refProps->{$schemaProp->name}) }; - if (my $e = $@) { - push @errors, $e; - } else { - $refProps->{$schemaProp->name} = $result; - } - } - return @errors; -} - -sub inflateValue { - my ($this,$value,$node,$strict) = @_; - - $strict ||= 0; - $node ||= $this->Current; - - my $nodeSchema = $this->{$_schemaNavi}->Current; - - my $result = eval { $nodeSchema->inflateValue($value) }; - if (my $e=$@) { - $this->BuildErrors->Append(new IMPL::DOM::Schema::ValidationError( - schema => $nodeSchema, - node => $node, - error => $e, - message => $nodeSchema->messageInflateError, - source => $this->{$_schemaNavi}->SourceSchemaNode - )); - return $strict ? undef : $value ; - } else { - return $result; - } -} - sub Back { my ($this) = @_; @@ -138,11 +83,6 @@ $this->SUPER::restoreState; } -#compatibility -sub buildErrors { - goto &BuildErrors; -} - sub document { goto &Document; } diff -r 0d63f5273307 -r 4bdf155e5bfe Lib/IMPL/DOM/Node.pm --- a/Lib/IMPL/DOM/Node.pm Tue Feb 11 01:05:55 2014 +0400 +++ b/Lib/IMPL/DOM/Node.pm Tue Feb 11 01:06:40 2014 +0400 @@ -23,8 +23,8 @@ nodeValue => PROP_RW | PROP_DIRECT, childNodes => { get => \&_getChildNodes, isList => 1, direct => 1 }, parentNode => PROP_RO | PROP_DIRECT, - schema => PROP_RO | PROP_DIRECT, - schemaSource => PROP_RO | PROP_DIRECT, + schemaNode => PROP_RO | PROP_DIRECT, + schemaType => PROP_RO | PROP_DIRECT, _propertyMap => PROP_RW | PROP_DIRECT ] }; @@ -486,15 +486,15 @@ Ссылка на родительский элемент, если таковой имеется. -=item C<[get] schema> +=item C<[get] schemaType> Ссылка на узел из C, представляющий схему данных текущего узла. Может быть C. -=item C<[get] schema> +=item C<[get] schemaNode> Ссылка на узел из C, представляющий элемент схемы, объявляющий данный узел. Может быть C. -Отличается от свойства C тем, что узел в случае ссылки на тип узла, данной свойство будет содержать +Отличается от свойства C тем, что узел в случае ссылки на тип узла, данной свойство будет содержать описание ссылки C, а свойство C например будет ссылаться на C. diff -r 0d63f5273307 -r 4bdf155e5bfe Lib/IMPL/DOM/Schema/Node.pm --- a/Lib/IMPL/DOM/Schema/Node.pm Tue Feb 11 01:05:55 2014 +0400 +++ b/Lib/IMPL/DOM/Schema/Node.pm Tue Feb 11 01:06:40 2014 +0400 @@ -45,9 +45,9 @@ } sub Validate { - my ($this,$node) = @_; + my ($this,$node,$ctx) = @_; - if (my $schemaType = $this->{$type} ? $this->document->resolveType($this->{$type}) : undef ) { + if (my $schemaType = $this->{$type} ? $this->document->ResolveType($this->{$type}) : undef ) { my @errors = $schemaType->Validate($node,{Source => $this}); return @errors; } else { @@ -67,12 +67,6 @@ return ($this->{$maxOccur} eq 'unbounded' || $this->{$maxOccur} > 1 ) ? 1 : 0; } -sub inflateValue { - $_[1]; -} - -sub inflator { undef } - sub qname { $_[0]->nodeName.'[name='.$_[0]->{$name}.']'; } @@ -123,18 +117,6 @@ Имя узла. -=item C<[get,set] display> - -Имя узла для отображения. - -=item C<[get,set] display_no> - -Имя узла для отображения (родительный падеж). - -=item C<[get,set] display_blame> - -Имя узла для отображения (винительный падеж). - =back =cut diff -r 0d63f5273307 -r 4bdf155e5bfe Lib/IMPL/DOM/XMLReader.pm --- a/Lib/IMPL/DOM/XMLReader.pm Tue Feb 11 01:05:55 2014 +0400 +++ b/Lib/IMPL/DOM/XMLReader.pm Tue Feb 11 01:06:40 2014 +0400 @@ -61,7 +61,7 @@ sub _OnEnd { my ($this,$element) = @_; - $this->{$_current}->nodeValue($this->Navigator->inflateValue( $this->{$_text} ) ) if length $this->{$_text} and (not $this->{$SkipWhitespace} or $this->{$_text} =~ /\S/); + $this->{$_current}->nodeValue($this->{$_text}) if length $this->{$_text} and (not $this->{$SkipWhitespace} or $this->{$_text} =~ /\S/); $this->{$_text} = pop @{$this->{$_textHistory}}; $this->{$_current} = $this->Navigator->Back; }