|
Keith, JDOM will be very slow for what you are trying to accomplish. Are you just trying to add some logging to see how long this is taking? For logging I like to use the Jakarta Commons logging interfaces. There is a simple log implementation that writes to the console. With the simple log, you could just include time in the output message and log something like "start of load", and "end of load". I wrapped the Jakarta commons logging in a single static class that makes it easier to use on the AS/400. I also created a log implementation that writes logging messages to the joblog. Here is something I wrote up on how to use this: http://www.midrangeserver.com/mgo/mgo100402-story02.html You can download the source from CVS at SourceForge. There is one additional class I added after the article was published. It is: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/iseries-toolkit/iseries-toolkit/src/java/org/iseriestoolkit/util/DefaultLog.java?rev=HEAD&content-type=text/vnd.viewcvs-markup David Morris >>> keith_mccully@wunderman.co.uk 12/17/02 08:33AM >>> This is a multipart message in MIME format. -- [ Picked text/plain from multipart/alternative ] I had a requirement to convert a 25,000 customer detail element xml into an iSeries PF. Each element had around 2.5 Kb data and a total of nearly 60 Mb. The xml structure is flat, ie customer detail element has no sub elements, just attributes : <custdata atr1="val1" atr2="val2" .........atrN="valN" />. Each customer element converts to a PF record and each attribute to a PF column. My preferred choice would be to use JDOM as it's straightforward to code and great for random access to the DOM tree. However the whole DOM tree is loaded into memory and given the volume of data this will raise performance issues. Instead, I chose the SAX APIs from the Xerces parser. Since, SAX uses event driven processes which are ideal for a straight through read of the xml document and will not load the whole document into memory so avoiding the performance issues. With SAX the whole parse/load process took about 2.5 minutes on an 830 machine which was good. I would liked to have run a JDOM load for a comparison but didn't have time although I suspect that it would take much longer. Just 1 question. Is there any restriction or scoping as to what can be called from the ContentHandler methods against ordinary methods? I instantiated the Date class in the startDocument method to a member level variable and then did t oString() to print the start time: d = new Date(); System.out.println(d.toString()); This printed OK but when I did System.out.println(d.toString()); to print the end time in the endDocument method I got a null exception on reference d. I expected this to work since d was a member variable. Does anyone the cause of this and a workaround other than a second Date instantiation. Thanks, Keith
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.