Mercurial > pub > Impl
changeset 13:bb8d67f811ea
merge heads
author | Sergey |
---|---|
date | Wed, 02 Sep 2009 23:11:14 +0400 |
parents | 955b2324c1bf (diff) 75980091813b (current diff) |
children | 65a7bb156fb7 |
files | Lib/IMPL/DOM/Navigator.pm Lib/IMPL/DOM/Navigator/Builder.pm Lib/IMPL/DOM/XMLReader.pm _test/any.t impl.kpf |
diffstat | 3 files changed, 87 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Lib/IMPL/DOM/XMLReader.pm Wed Sep 02 17:47:44 2009 +0400 +++ b/Lib/IMPL/DOM/XMLReader.pm Wed Sep 02 23:11:14 2009 +0400 @@ -26,6 +26,21 @@ $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) = @_; @@ -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
--- a/_test/Resources/test.schema Wed Sep 02 17:47:44 2009 +0400 +++ b/_test/Resources/test.schema Wed Sep 02 23:11:14 2009 +0400 @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <schema> + <!-- Директивы --> <!-- Загрузка фрагмента схемы --> <Include src="basic.types.schema"/> + <!-- Содержимое возможные варианты для документов--> <ComplexNode nodeName="Form"> <NodeSet> <SimpleNode nodeName="FirstName">
--- a/impl.kpf Wed Sep 02 17:47:44 2009 +0400 +++ b/impl.kpf Wed Sep 02 23:11:14 2009 +0400 @@ -118,6 +118,32 @@ </preference-set> </preference-set> </preference-set> +<preference-set idref="66c7d414-175f-45b6-92fe-dbda51c64843/Lib/IMPL/DOM/Navigator/Builder.pm"> +<preference-set id="Invocations"> +<preference-set id="default"> + <string id="cookieparams"></string> + <string id="cwd"></string> + <long id="debugger.io-port">9011</long> + <string id="documentRoot"></string> + <string id="executable-params"></string> + <string relative="path" id="filename">Lib/IMPL/DOM/Navigator/Builder.pm</string> + <string id="getparams"></string> + <string id="language">Perl</string> + <string id="mpostparams"></string> + <string id="params"></string> + <string id="postparams"></string> + <string id="posttype">application/x-www-form-urlencoded</string> + <string id="request-method">GET</string> + <boolean id="show-dialog">1</boolean> + <boolean id="sim-cgi">0</boolean> + <boolean id="use-console">0</boolean> + <string id="userCGIEnvironment"></string> + <string id="userEnvironment"></string> + <string id="warnings">enabled</string> +</preference-set> +</preference-set> + <string id="lastInvocation">default</string> +</preference-set> <preference-set idref="66c7d414-175f-45b6-92fe-dbda51c64843/Lib/IMPL/DOM/Schema/Item.pm"> <preference-set id="Invocations"> <preference-set id="default"> @@ -144,6 +170,32 @@ </preference-set> <string id="lastInvocation">default</string> </preference-set> +<preference-set idref="66c7d414-175f-45b6-92fe-dbda51c64843/Lib/IMPL/DOM/XMLReader.pm"> +<preference-set id="Invocations"> +<preference-set id="default"> + <string id="cookieparams"></string> + <string id="cwd"></string> + <long id="debugger.io-port">9011</long> + <string id="documentRoot"></string> + <string id="executable-params"></string> + <string relative="path" id="filename">Lib/IMPL/DOM/XMLReader.pm</string> + <string id="getparams"></string> + <string id="language">Perl</string> + <string id="mpostparams"></string> + <string id="params"></string> + <string id="postparams"></string> + <string id="posttype">application/x-www-form-urlencoded</string> + <string id="request-method">GET</string> + <boolean id="show-dialog">1</boolean> + <boolean id="sim-cgi">0</boolean> + <boolean id="use-console">0</boolean> + <string id="userCGIEnvironment"></string> + <string id="userEnvironment"></string> + <string id="warnings">enabled</string> +</preference-set> +</preference-set> + <string id="lastInvocation">default</string> +</preference-set> <preference-set idref="66c7d414-175f-45b6-92fe-dbda51c64843/Lib/IMPL/Object.pm"> <preference-set id="Invocations"> <preference-set id="default">