Mercurial > pub > Impl
diff Lib/IMPL/DOM/XMLReader.pm @ 12:955b2324c1bf
Работа над навигаторами и схемой DOM модели
author | Sergey |
---|---|
date | Mon, 31 Aug 2009 01:37:43 +0400 |
parents | 63f6653b094e |
children | bb8d67f811ea |
line wrap: on
line diff
--- a/Lib/IMPL/DOM/XMLReader.pm Fri Aug 28 16:26:20 2009 +0400 +++ b/Lib/IMPL/DOM/XMLReader.pm Mon Aug 31 01:37:43 2009 +0400 @@ -26,10 +26,25 @@ $parser->parse($in); } +sub ParseFile { + my ($this,$in) = @_; + + my $parser = new XML::Parser( + Handlers => { + Start => sub {shift; goto &OnStart($this,@_)}, + End => sub {shift; goto &OnEnd($this,@_)}, + Char => sub {shift; goto &OnChar($this,@_)} + } + ); + + $parser->parsefile($in); +} + + sub OnBegin { my ($this,$element,%attrs) = @_; - $this->{$_current} = $this->Navigator->CreateAndNavigate($element,%attrs); + $this->{$_current} = $this->Navigator->NavigateCreate($element,%attrs); } sub OnEnd { @@ -45,3 +60,21 @@ } 1; + +__END__ + +=pod + +=head1 SYNOPSIS + +my $reader = new IMPL::DOM::XMLReader(Navigator => $DomBuilder); +my $obj = $reader->parsefile("data.xml"); + +=head2 DESCRIPTION + + , . + . + + C<NavigateCreate> C<Back> + +=cut