<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 5.50.4207.2601" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=236513821-02042001>As an 
amendment to my last email:</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=236513821-02042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=236513821-02042001>It 
would also be useful to have the new SAXPatternBuilder (or whatever it's 
called)&nbsp; return JDOM objects via a callback rather than is a list.&nbsp; 
This should be obvious, because LARGE XML files are involved.&nbsp; If all 
objects were returned in at once in a List, it would defeat the 
purpose.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=236513821-02042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=236513821-02042001>Scott</SPAN></FONT></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Jakob Jenkov 
  [mailto:jakob@jenkov.com]<BR><B>Sent:</B> Monday, April 02, 2001 4:34 
  PM<BR><B>To:</B> jdom-interest@jdom.org<BR><B>Subject:</B> [jdom-interest] 
  Partial Tree building/instantiation --- XPathFilter<BR><BR></FONT></DIV>
  <DIV><FONT face=Arial size=2>Hi There.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>I'm currently working on a long, long :-) project 
  in which we parse through some quite long files. We have tried converting 
  these files to XML for easier/standard parsing but each file will then be of a 
  size of about 16-30+ MB each. I don't even dare think about how much memory 
  such a JDOM tree would take! And the plans for lazy evaluation won't help, 
  since we are visiting every node in the tree, thus instantiating all objects 
  anyway. Parsing the trees solely using SAX is not developer-friendly enough. 
  What I have in mind is some kind of a XPath filter, allowing you to build JDOM 
  trees from sub trees from the data, and dipose these trees when I don't longer 
  need that tree. Let me give an example:</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>We parse phone call records in files that 
  sometimes can contain thousands and thousands of records. In XML format these 
  files and records would look something like this:</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&lt;transferBatch&gt;</FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &lt;phoneCall&gt;</FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  &lt;details&gt;bla.bla.bla., sub records etc.&lt;/details&gt;</FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; 
&lt;/phoneCall&gt;</FONT></DIV>
  <DIV><FONT face=Arial size=2>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &lt;phoneCall&gt;</FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  &lt;details&gt;bla.bla.bla., sub records etc.&lt;/details&gt;</FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; 
&lt;/phoneCall&gt;</FONT></DIV>
  <DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &lt;phoneCall&gt;</FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  &lt;details&gt;bla.bla.bla., sub records etc.&lt;/details&gt;</FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; 
  &lt;/phoneCall&gt;</FONT></DIV></DIV></FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; ...</FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; ...</FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; ...</FONT></DIV>
  <DIV><FONT face=Arial size=2>&lt;/transferBatch&gt;</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Each &lt;phoneCall&gt; record with all it's sub 
  records can be quite large, and there can be thousands of these 
  &lt;phoneCall&gt; records. I'd like some way to get a JDOM tree for each 
  &lt;phoneCall&gt; record one at a time, and to be able to 
  dispose&nbsp;&lt;phoneCall&gt; JDOM tree before moving on to the next. How 
  will I do that?</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>My Suggestion would be to insert an XPathFilter, 
  that only builds JDOM trees from the records that match the given XPath. In 
  the example above, an XPath of&nbsp;&nbsp;&nbsp; 
  transferBatch::phoneCall&nbsp;&nbsp; would have done the job.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Does my complaints/ideas sound completely 
  out-of-this-world? I think there are many out there who will&nbsp;have the 
  same problem, parsing one sub tree at a time, without regard to the 
  others.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
  <DIV><FONT face=Arial size=2>Jakob Jenkov</FONT></DIV>
  <DIV><FONT face=Arial size=2>jakob@jenkov.com</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV></BLOCKQUOTE></BODY></HTML>