From: SourceForge.net <no...@so...> - 2007-07-20 11:30:24
|
Bugs item #1757419, was opened at 2007-07-20 10:03 Message generated for change (Comment added) made by pillesoft You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1757419&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: targeted for 2.2rc2 Status: Open Resolution: None Priority: 5 Private: No Submitted By: pillesoft (pillesoft) Assigned to: Nobody/Anonymous (nobody) Summary: xml handling in jython and in python works different Initial Comment: Dear All, i have a strange problem, which i don't understand. i need to parse an xml string, which works different in python 2.4.2 and in jython 2.2rc2 please check the attached files, and run the py code in python and in jython2.2rc2 you will see that in jython there are nodes where more textnodes exist, while in python every node has only one textnode. if there is a problem in the code, please give me some help? thank you Ivan ---------------------------------------------------------------------- >Comment By: pillesoft (pillesoft) Date: 2007-07-20 11:30 Message: Logged In: YES user_id=1305345 Originator: YES Dear All, thank you for dealing with my problem. i tried to create a smaller xml file, but then i don't receive any differences in python, and jython. i think the problem is really the size of the string. in my xp i use notetab light as a simple text editor the application which i'm developing is an interface between a vfp based com and primavera java api. the xml is to exchange information between the two different systems. therefore it is more likely to need to work even bigger strings. ---------------------------------------------------------------------- Comment By: Alan Kennedy (amak) Date: 2007-07-20 11:18 Message: Logged In: YES user_id=647684 Originator: NO Hmm. I don't have cpython 2.4.2, I have cpython 2.4.4. When I run your code on cpython 2.4.4, I get nothing at all, no output, zippo. When I run your code on jython 2.2rc2, I get some output, but I can't tell whether it's correct or not, because I can't look at your XML file; I can't find a text editor that can handle 760,000 bytes all on the same line. I suggest you put some newlines into your XML file. At least then we'll be able to see what's inside it. It's quite possible that the extra long line is the source of your problems. I don't have a specific mechanism in mind, but do remember that files opened in text mode undergo line-ending translation, which means they pass through internal buffers and processing at some stage. It is unlikely that these buffers are big enough to hold the entirety of your 760000-byte string at once. (They should still be able to process it correctly, but perhaps there's a bug in there, caused by the enormity of the string, that has nothing to do with XML at all). So I'd tidy up your XML as a first step, i.e. put a lot more newlines in it. ---------------------------------------------------------------------- Comment By: Pekka Laukkanen (laukpe) Date: 2007-07-20 10:46 Message: Logged In: YES user_id=1379331 Originator: NO Could you please create the simplest possible example where something goes wrong? The xml file you attached is huge -- I'm sure you can create a simpler one showing the same problem. Your Python code is ok otherwise but it contains hard coded path (d:\temp\pms_act.xml) so it won't run without editing. Probably the best would be if you created just one .py file where you had the xml as string. Then you could simply attach that file (instead of a zip) to the bug report so that it would be easier to view and download the code. Your example could look something like below. from xml.dom import minidom from StringIO import StringIO myxml = """<hello> world </hello>""" mydom = minidom.parse(StringIO(myxml)) # do something demonstrating the problem here ... If you make the example simple it is more likely that someone will actually take a look at it. I'm doing all my little Jython contributions totally on my own time. I know something about xml and could investigate this out of my own interest but I'm not planning to spent time on getting the example running first. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1757419&group_id=12867 |