It is a Ximple (http://goreliance.com/devel )data structure to hold XML
tree.. It goes like this...

 <ximple_tree>     ::=  [ <ximple_tag> ... ]

 <ximple_tag>      ::=  { tag_name => <tag-name>,
                          attribs  => <attribs>
                          content => <ximple_tree>

When we create XML from say comma delimited or fixed width records, of
which there could be thousands, we end up with a side span that contains
thoudands of children under the root node. It is this that breaks
Any2XML. There would be less problem with fewer children, as everyone
agrees :)

One solution is to print out the children every say x number of records.
This is what we have done. This needs a parameter from the user as
Any2XML itself does not know what it is parsing. 

This is the code that creates the structure...
# -------------inside Any1xml -----------
sub xml_routine {
  my ($tag,$text) = @_;
  my @ret;
  while (my @mem = get_match($tag,\$text)) {
    push (@ret,{tag_name=>$tag->{tag_name},
      content=>get_content($tag,\@mem), 
      attrib=>get_attrib($tag,\@mem),
 
tag_type=>($tag->{attrib}{'_fill'}||$tag->{attrib}{'%fill'})?undef:$tag-
>{tag_type}});
  }
  return \@ret;
}
>From the suggestions, I gather that by tieing this structure to an
array, we can print out the array as each element is created.

Questions: Could the "Tie" be done outside the module so Any2xml is not
aware of it? The array @ret is lexically scoped here. If it is globally
scoped (our @ret) this should be possible right?

---Closing information gaps-----
Ranga Nathan, Reliance Technololgy
>>Live demo at http://any2xml.com/docs/timesheet_demo.shtml<<
>>Get free COBOLExplorer at http://goreliance.com/download-products <<

> -----Original Message-----
> From: Brian Reichert [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, September 30, 2002 12:30 PM
> To: Ranga Nathan
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Boston.pm] Large hashes
> 
> 
> On Sun, Sep 29, 2002 at 09:31:01PM -0400, Ranga Nathan wrote:
> > Are there any special techniques for handling large hashes. When 
> > building an XML tree as a Perl data structure, at times 
> more and more 
> > memory is being consumed eventually runs out of memory. Other than 
> > partitioning the problem is there any known technique?
> 
> Would this simple be a matter using tie() with your hash? I 
> suppose it depends on what data structures are in your hash.
> 
> When you say you have a 'large hash', do you mean that you 
> have lots of keys?  Or do you mean that you're shoving lots 
> of big key, values into it?  Or do you mean that it contains 
> references to really big data structures?
> 
> > ---Closing information gaps-----
> > Ranga Nathan, Reliance Technololgy
> > >>Live demo at http://any2xml.com/docs/timesheet_demo.shtml<<
> > >>Get free COBOLExplorer at 
> http://goreliance.com/download-products <<
> -- 
> Brian 'you 
> Bastard' Reichert             <[EMAIL PROTECTED]>
> 37 Crystal Ave. #303                  Daytime number: (603) 434-6842
> Derry NH 03038-1713 USA                       Intel 
> architecture: the left-hand path
> 

_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to