Handle unprefixed attributes in Element#attribute correctly #151
+17 −34
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Currently,
Element#attrubutehandles unprefixed attributes as attributes with the default namespace, and handles the default namespace asnilvalue. However, it is a mis-interpretation of the specification of XML 1.0.XML 1.0 specification says:
(https://www.w3.org/TR/xml-names/#defaulting)
Therefore, we need to distinguish
niland the default namespace. Also, unprefixed attributes should not be handled as attributes with the default namespace.Note that XML 1.0 specification also says:
This means that we can know (programmatically) how to handle unprefixed attributes from the element's namespace. It does not mean that the namespace of an unprefixed attribute becomes the default namespace.
This commit changes
Element#attributebehavior correctly and updates tests for it.@kou It breaks backward compatibility, so I'm concerned. What do you think?