49
|
1 package IMPL::DOM::Post2DOM;
|
|
2 use strict;
|
|
3 use warnings;
|
|
4
|
|
5 use IMPL::DOM::Navigator;
|
|
6 use IMPL::Class::Property;
|
|
7
|
|
8 use base qw(IMPL::Transform);
|
|
9
|
|
10 BEGIN {
|
|
11 public property Navigator => prop_get | owner_set;
|
|
12 }
|
|
13
|
|
14 our %CTOR = (
|
|
15 'IMPL::Transform' => sub {
|
|
16 return (
|
|
17 HASH => \&TransfromPostData
|
|
18 );
|
|
19 }
|
|
20 );
|
|
21
|
|
22 sub TransformPostData {
|
|
23 my ($this,$data) = @_;
|
|
24
|
|
25 my $navi = $this->Navigator;
|
|
26
|
|
27 while (my ($key,$value) = each %$data) {
|
|
28 my $node = $navi->Navigate($key);
|
|
29 $node->nodeValue($value);
|
|
30 }
|
|
31
|
|
32 return $navi->Document;
|
|
33 }
|
|
34
|
|
35
|
|
36 1;
|