-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
minidom Level 1 DOM compliance #44871
Comments
Tested on: Mac OS X 10.4.9 This patch fixes numerous bugs in xml.dom.minidom and expatbuilder. Changes: These are mainly fixes for bugs found by the W3C DOM Test
DOM Level 1 bugs remaining:
I haven't even tried to run DOMTS level2 tests yet. I'm sure it'll be |
Justification for the most significant changes:
|
Wow this patch is big! I notice a lot of whitespace changes, can you drop those from the patch, it will make it easier to review. I don't see any extra whitespace in the original, so maybe if you ran Tools/scripts/reindent.py over the code that would clean it up. I think that's what Tim uses to normalize whitespace. The new tests are good to see. I see you added doc for a new method in xmlparser, but the new class EntityReference from minidom.py is not documented. In xml/dom/minidom.py, it seems odd to see if cond: pass else: # do something. What about inverting the condition so pass/else is not necessary. The comment could be improved here as to why this is a no-op. The patch itself looked fine to me. I didn't review in complete context (ie, I didn't apply it and review all the code), just the patch itself. I don't know enough about minidom to know if this change it good or not. Other than what I noted above, the patch looks decent on the surface. |
Neal, thanks for looking at this. Size: Yeah. :-\ I don't know what to do about this. There were a lot of bugs, so there are a lot of diffs. :( Whitespace: I checked, and the extra whitespace is definitely in trunk's Lib/test/test_minidom.py; a recent change added it. This patch removes it. (I could revert the whitespace anyway, just to reduce the size of the patch. Let me know if I should do this.) Doc: Oops! I will fix this today and upload a new patch. pass: Thanks, I'll change as suggested. (Just to explain myself-- I used "if name == 'nodeValue': pass; else: ..." because 'nodeValue' is the special case, and the special behavior is "do nothing". But I'm not attached to that wording. I'll change it.) |
OK, the updated patch has the suggested changes (Doc for EntityReference; eliminated "pass" and added comment in Node.__setattr__). File Added: minidom-level-1-compliance.2.patch |
Jason, don't worry about the size, I was mostly complaining about the whitespace diffs. I know Tim hadn't done a normalization step for a while. I just did it and am running the tests now. Damn there are a lot! :-( The good news is that your patch will go down. The bad news for you is that you are going to have to regenerate it and there will probably be conflicts. I'm hoping Martin will review it as he's quite knowledgeable about XML. I doubt there is any more that I can contribute to this patch other than to say it needs some expert eyes on it, but generally looks good. The tests should be done within 15 minutes or so. Then I'll check in whitespace normalization. |
File Added: minidom-level-1-compliance.3.patch |
I guess we'll need a number of iterations. Some observations:
More later. |
Martin, thank you very, very much for looking at this. Happy to
http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-1950641247
"All XML parsed entities (including document entities) SHOULD be fully http://www.w3.org/TR/xml11/#sec-normalization-checking DOM Level 3 provides a "normalize-characters" option. Implementations http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html#parameter-normalize-characters I want to add normalization to writexml() and toxml(), but I hope it |
Martin, This version of the patch moves name-checking into a separate module, "xml.names". But for now it is undocumented (intentionally). Also, DOMImplementation.hasFeature("XMLVersion", v) now returns True for v in ("1.0", "1.1"), and setting doc.xmlVersion to any other value raises NotSupportedErr. (Both these things are specified in DOM Level 3 Core under the Document.xmlVersion attribute.) Added a test for this, too. I didn't make any other changes. Let me know if I'm wrong about those other two things. File Added: minidom-level-1-compliance.4.patch |
Martin, do I need to change anything else? |
Changed type to behaviour as I see many references to bugs, hence the changes to versions. This is a massive patch and will be a substancial amount of work if anyone wishes to take it on. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: