<!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 size=2>Have you tried increasing the heap size for your Java
VM?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>With the Sun JVM, the non-standard options -Xms and -Xmx can
be used to override the initial and maximum heap sizes -- try java -X to find
out about these options. I believe that the default sizes are small enough that
you could get problems when dealing with a number of 20MB objects.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>John Hurst</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV style="FONT: 10pt arial">----- Original Message -----
<DIV style="BACKGROUND: #e4e4e4; font-color: black"><B>From:</B> <A
href="mailto:prakashivb@usa.net" title=prakashivb@usa.net>prakash ivb</A> </DIV>
<DIV><B>To:</B> <A href="mailto:jdom-interest@jdom.org"
title=jdom-interest@jdom.org>jdom-interest@jdom.org</A> </DIV>
<DIV><B>Sent:</B> Saturday, January 20, 2001 9:18 AM</DIV>
<DIV><B>Subject:</B> [jdom-interest] out of memory while processing large xml
files</DIV></DIV>
<DIV><BR></DIV>hai,<BR><BR>
i am trying to parse multiple xml files with each file of 20M<BR>size and i am
getting out of memory error. is there any way i can solve my<BR>problem. the
code is given below:<BR><BR><BR>import java.io.*;<BR>import
java.util.*;<BR>import org.jdom.*;<BR>import org.jdom.input.*;<BR>import
org.jdom.output.*;<BR>import org.jdom.JDOMException;<BR><BR>class extn
implements FilenameFilter {<BR> String ext;<BR> public extn (String
ext) {<BR> this.ext = "." + ext;<BR> }<BR> public
boolean accept(File dir, String name) {<BR> return
name.endsWith(ext);<BR> }<BR>}<BR><BR>public class JdomParser {<BR>
<BR> public static void main(String args[]) {<BR> if
(args.length !=1) {<BR>
System.out.println("Usage: JdomParser [filename to
parse]");<BR>
return;<BR> }<BR> try
{<BR> String dirname =
"n:"+File.separator+"data"+File.separator + args[0] +<BR>File.separator+
"rawdata";<BR> File f = new File(dirname);<BR>
FilenameFilter files = new extn("xml");<BR> String s3[] =
f.list(files);<BR> int ct =
1;<BR> System.out.println("Parsing Begins at
" + d + "\n");<BR> for (int k=0;
k<s3.length;k++) {<BR>
SAXBuilder builder = new SAXBuilder(false);<BR>Document doc =
builder.build(new File(f, s3[k]));<BR>System.out.println("Parsing File: "
+ s3[k] + "\n"); <BR> Element root =
doc.getRootElement();<BR> List node =
root.getChild("Collection")<BR>
.getChild("Iteration")<BR>
.getChildren("Device");<BR>
<BR> Iterator i =
node.iterator();<BR> while (i.hasNext())
{<BR> Element elem =
(Element)i.next();<BR> String s =
elem.getChild("Node")<BR>
.getText();<BR>
System.out.println("Parsing No. " + ct + " Node: " + s +
"\n");<BR> List command =
elem.getChildren("Command");<BR>
Iterator j =
command.iterator();<BR>
System.out.println(" Parsing Commands...
\n");<BR> int ct1 =
1;<BR> while (j.hasNext())
{<BR> Element
comelem =
(Element)j.next();<BR>
String s1 =
comelem.getChild("Command_String").getText();<BR>
String s2 =
comelem.getChild("Command_Data").getText();<BR>
System.out.println(" " +ct1 +" : " + s1 +
"\n");<BR>
System.out.println(" Parsing Command
Data...\n");<BR>
ct1++;<BR>
}<BR>
ct++;<BR>
}<BR> System.out.println("Document " + s3[k]
+ " successfully parsed\n");<BR> ct =
1;<BR>
}<BR>
<BR> } catch (JDOMException e)
{<BR> System.out.println( "ERROR: " +
e.getMessage());<BR> }<BR>
}<BR> <BR>}<BR>i will appreciate you help.<BR><BR><BR>prakash
Inuganti<BR><BR><BR><BR>____________________________________________________________________<BR>Get
free email and a permanent address at <A
href="http://www.netaddress.com/?N=1">http://www.netaddress.com/?N=1</A><BR>_______________________________________________<BR>To
control your jdom-interest membership:<BR><A
href="http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com">http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com</A></BODY></HTML>