Yes its saving the memory.
   
  But now am into a new problem :(
   
  Its taking lot of time to parse a file.
   
  Is there any way to create chunks so that it wont parse the entire file.
   
  my requirement is to read the chunks based on an attribute.
   
  I tried 
   
  my $twig = XML::Twig->new(twig_roots => {'[EMAIL PROTECTED]"'.$ID.'"]' => 
\&chunks});
$twig->parse($showtimeString);
   
  sub chunks{
 my( $twig, $reOrganize)= @_; 
 $chunkedIXMLG = $_->sprint;
 $twig->purge; 
}
  sub myprocess
  {
  print $chunkedIXMLG;
  }
  Also 
   
  my $twig = XML::Twig->new(twig_handlers => {'[EMAIL PROTECTED]"'.$ID.'"]' => 
\&chunks});
$twig->parse($showtimeString);
   
  sub chunks{
 my( $twig, $reOrganize)= @_; 
 $chunkedIXMLG = $_->sprint;
 $twig->purge; 
}
   
  Since it is reading the whole file each time to parse the node based on the 
ID.It is taking lot of time.
   
  Thanks in advance,
  Prabu

Jenda Krynicky <[EMAIL PROTECTED]> wrote:
  From: Prabu Ayyappan 

> Thanks for the valuable inputs,
> 
> I am planning to solve my memory issue by making the XML into Chunks
> using Xml::Twig and using simplify( ) in XML::Twig to convert that
> chunks back into the Hash data structure. 
> 
> Is that advicable method to proceed to reduce my Memory size.So that
> after processing that chunk i will purge my memory (purge in
> XML::Twig) 
> 
> Thanks in advance,
> Prabu

Yes, this should reduce the memory footprint while keeping the 
necessary changes to the script small. I think in your case it's the 
best solution.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




       
---------------------------------
Got a little couch potato? 
Check out fun summer activities for kids.

Reply via email to