<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi All, </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I am writing an app that merges smaller XML docs
into a larger one based on some rules.</FONT></DIV>
<DIV><FONT face=Arial size=2>I am trying toget a handle om the "seamlessness" of
SAX versus DOM access. Below, I </FONT></DIV>
<DIV><FONT face=Arial size=2>start with the first XML doc and then grow it by
adding to stuff from the following XML files.</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>So my current program I pull the small files into
"doc" documentand I itereate down the "doc" </FONT></DIV>
<DIV><FONT face=Arial size=2>dom tree of the small files until I
find </FONT><FONT face=Arial size=2>a specific node and use XPath to find
the corresponding </FONT></DIV>
<DIV><FONT face=Arial size=2>node in the largerer doc</FONT><FONT face=Arial
size=2> "largedoc" . So "largedoc" is filling up memory until it crashes.
What do I need</FONT></DIV>
<DIV><FONT face=Arial size=2>to access "largedoc" seamlessly, but
using SAX to I don't fill up memory?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Cheers, Brian</FONT> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>IE beginning.....</FONT></DIV>
<DIV><FONT size=2>
<P>public static void main(String[] args) {</P>
<P>try { </P>
<P>SAXBuilder builder3 = new SAXBuilder();</P>
<P>Document largedoc = builder3.build( args[0] );</P>
<P>Vector addrTextVect = new Vector();</P>
<P>elementProc eP = new elementProc(largedoc, addrTextVect);</P>
<P></P>
<P>Element rt = largedoc.getRootElement(); </P>
<P></P>
<P>eP.processFile(rt,args[0]); </P>
<P> </P>
<P><FONT face=Arial>Now here is where I add to "largedoc" stuff from
"doc"</FONT></P><FONT size=2>
<P>public void processAddresses(Element e)</P>
<P>{</P>
<P>List inchildren = new ArrayList();</P>
<P>inchildren = e.getChildren();</P>
<P>try</P>
<P>{</P>
<P>String xpath_str = "/file/addresses" ;</P>
<P>XPath xpath = new XPath( xpath_str );</P>
<P>Element eAddr = (Element) xpath.selectSingleNode( largedoc );</P>
<P> </P>
<P>for(int i=0 ;i < inchildren.size() ;i++)</P>
<P>{</P>
<P> </P></FONT></FONT></DIV></BODY></HTML>