What do you want printed, and in what format?
Main Topics
Browse All TopicsHi Experts,
This is continuing from http://www.experts-exchang
This is printing the failed eids.
I want to print time-process-complete tag and I want to sort output by this tag.
I'm using python 2.3
BR Dushan
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Two hours seems too much to me (for 135 MB). How many records are expected in the result list (i.e. tens, hundreds, thousands, millions)?
The long processing time could be because of the xml.dom.minidom principal features and also because not of its inefficient implementation in Python. I suggest to use the SAX parser in this case. Try the snippet below. The way of compounding the line with info is because of the sorting. It can be generalized -- the info can be collected to tuples, then sort can be done via supplying your own comparison function, and printing the result can also be customized.
I have tested it only with your sample -- one line in result like (tab separated):
2007-05-22T20:00:00+00:00 766877_765765765_load .\doc.xml
Thanks a lot! but when I'm executing this script against my list of all files( 138MB), it gives following error.
--------------------------
File "feedback_failed.py", line 113, in ?
main()
File "feedback_failed.py", line 103, in main
lst = listOfFailed(fname) # get the failed eids records (as strings)
File "feedback_failed.py", line 87, in listOfFailed
parser.parse(fname) # parse
File "lib/python2.3/xml/sax/exp
File "lib/python2.3/xml/sax/xml
File "lib/python2.3/xml/sax/exp
File "lib/python2.3/xml/sax/exp
File "feedback_failed.py", line 67, in endElement
self.lst.append(tpc + u'\t' + eid + u'\t' + self.fname)
MemoryError
--------------------------
Earlier with dom , I didn't get such error. Only thing was it's getting more than 2 hours time.
Please let me know best solution.
Thanks again!
Dushan.
File "feedback_failed.py", line 115, in ?
main()
File "feedback_failed.py", line 105, in main
lst = listOfFailed(fname) # get the failed eids records (as strings)
File "feedback_failed.py", line 89, in listOfFailed
parser.parse(fname) # parse
File "lib/python2.3/xml/sax/exp
File "lib/python2.3/xml/sax/xml
File "lib/python2.3/xml/sax/exp
File "lib/python2.3/xml/sax/exp
File "feedback_failed.py", line 63, in endElement
tpc = ''.join(self.tpc)
MemoryError
Well, then the opposite approach may be needed. The problem is that based on the XML encoding, the collected characters (i.e. one character strings) could be the Unicode ones. Can you post a simplified example of a XML file that is to be processed by the script and that causes the error? I'll try to install the Python 2.3...
Meanwhile, you can try to use something like
tpc = u''.join(self.tpc)
instead of
tpc = ''.join(self.tpc)
(also in other similar cases) and the
self.lst.append(u'%s\t%s\t
instead of
self.lst.append('%s\t%s\t%
Well, I have just installed Python 2.3.5 and converted the script to use (blindly, mechanically) the Unicode string literals only -- saved in UTF-8 with Signature, LF ended lines. The same way, the doc.xml was converted. It runs without errors on my Windows machine. I do not have Linux at hands. Try to unzip and run the attached file.
I would greatly appreciate that if you could look at this also. :)
http://www.experts-exchang
Business Accounts
Answer for Membership
by: Dushan911Posted on 2009-08-28 at 08:45:45ID: 25208848
Input XML is below format as mentioned in http://www.experts-exchang e.com/Prog ramming/La nguages/ Sc ripting/Py thon/Q_246 09340.html
Select allOpen in new window