view Lib/IMPL/DOM/Navigator/SimpleBuilder.pm @ 104:196bf443b5e1

DOM::Schema RC0 inflators support, validation and some other things, Minor and major fixes almost for everything. A 'Source' property of the ValidationErrors generated from a NodeSet or a NodeList is subject to change in the future.
author wizard
date Tue, 11 May 2010 02:42:59 +0400
parents c289ed9662ca
children 76515373dac0
line wrap: on
line source

package IMPL::DOM::Navigator::SimpleBuilder;
use strict;
use warnings;

use base qw(IMPL::DOM::Navigator);

use IMPL::Class::Property;
use IMPL::Class::Property::Direct;

require IMPL::DOM::Navigator::SchemaNavigator;
use IMPL::DOM::Document;

BEGIN {
    public _direct property Document => prop_get | owner_set;
}

our %CTOR = (
    'IMPL::DOM::Navigator' => sub { IMPL::DOM::Document::Empty; }
);

sub NavigateCreate {
    my ($this,$nodeName,%props) = @_;
    
    my $node;
    if (! $this->{$Document}) {
        $node = $this->{$Document} = IMPL::DOM::Document->new(nodeName => $nodeName,%props);
        $this->_initNavigator($node);
    } else {
        die new IMPL::InvalidOperationException('Can\t create a second top level element') unless $this->Current;
        $node = $this->{$Document}->Create($nodeName,'IMPL::DOM::Node',\%props);
        $this->Current->appendChild($node);
        $this->internalNavigateNodeSet($node);
    }
    return $node;
}

sub inflateValue {
	$_[1];
}

1;