BioHazard has asked for the wisdom of the Perl Monks concerning the following question:
Here's the node:sub parseNode { my $node_id = shift(); my $node = XMLin( "$node_id.xml", searchpath => ['nodes'], forcear +ray => ['field', 'child'] ); my $template = HTML::Template->new( filename => "$node->{type}{id} +.html" ); $template->param( node_id => $node->{id}, type => $node->{type}{content}, type_id => $node->{type}{id}, title => $node->{title}, created => &parseTimeBySeconds($node->{created}), updated => &parseTimeBySeconds($node->{updated}), owner => $node->{owner}{content}, owner_id => $node->{owner}{id} ); foreach ( keys( %{$node->{data}{field}} ) ) { $template->param( $_ => $node->{data}{field}{$_}{content} ); } my $children = ''; foreach ( keys( %{$node->{data}{child}} ) ) { $children = $children . &parseNode($node->{data}{child}{$_}{co +ntent}); } $template->param( children => $children ); return $template->output(); }
<?xml version="1.0" encoding="ISO-8859-1" ?> <node id="432" title="Title of page" created="1001562046" updated="100 +2582217"> <type id="1">Thread</type> <owner id="31337">BioHazard</owner> <data> <field name="doctext">This is test content</field> <child id="1">433</child> <child id="2">435</child> </data> </node>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Node Parser too slow?
by grantm (Parson) on Nov 05, 2002 at 07:10 UTC | |
|
Re: Node Parser too slow?
by joe++ (Friar) on Nov 04, 2002 at 16:59 UTC | |
|
Re: Node Parser too slow?
by gjb (Vicar) on Nov 04, 2002 at 19:28 UTC | |
by grantm (Parson) on Nov 06, 2002 at 07:29 UTC | |
by gjb (Vicar) on Nov 06, 2002 at 11:37 UTC | |
|
Re: Node Parser too slow?
by BioHazard (Pilgrim) on Nov 08, 2002 at 11:57 UTC |