Mercurial > pub > Impl
diff Lib/IMPL/DOM/XMLReader.pm @ 14:65a7bb156fb7
Дом модель и схема
author | Sergey |
---|---|
date | Fri, 04 Sep 2009 16:38:15 +0400 |
parents | bb8d67f811ea |
children | c2e7f7c96bcd |
line wrap: on
line diff
--- a/Lib/IMPL/DOM/XMLReader.pm Wed Sep 02 23:11:14 2009 +0400 +++ b/Lib/IMPL/DOM/XMLReader.pm Fri Sep 04 16:38:15 2009 +0400 @@ -7,6 +7,8 @@ use IMPL::Class::Property::Direct; use XML::Parser; +__PACKAGE__->PassThroughArgs; + BEGIN { public _direct property Navigator => prop_get | owner_set; private _direct property _current => prop_all; @@ -31,9 +33,9 @@ my $parser = new XML::Parser( Handlers => { - Start => sub {shift; goto &OnStart($this,@_)}, - End => sub {shift; goto &OnEnd($this,@_)}, - Char => sub {shift; goto &OnChar($this,@_)} + Start => sub {shift; goto &_OnStart($this,@_)}, + End => sub {shift; goto &_OnEnd($this,@_)}, + Char => sub {shift; goto &_OnChar($this,@_)} } ); @@ -41,19 +43,19 @@ } -sub OnBegin { +sub _OnBegin { my ($this,$element,%attrs) = @_; $this->{$_current} = $this->Navigator->NavigateCreate($element,%attrs); } -sub OnEnd { +sub _OnEnd { my ($this,$element) = @_; $this->{$_current} = $this->Back; } -sub OnChar { +sub _OnChar { my ($this,$val) = @_; $this->{$_current}->nodeValue($this->{$_current}->nodeValue . $val); @@ -70,11 +72,29 @@ my $reader = new IMPL::DOM::XMLReader(Navigator => $DomBuilder); my $obj = $reader->parsefile("data.xml"); -=head2 DESCRIPTION +=head1 DESCRIPTION , . . C<NavigateCreate> C<Back> +=head1 METHODS + +=over + +=item C<CTOR(Naviagtor => $builder)> + + , + +=item C<$obj->Parse($in)> + + . xml , HANDLE. + +=item C<$obj->ParseFile($fileName)> + + C<$fileName>. + +=back + =cut