Repository navigation
Conversation
NCNAME_STR left COMBININGCHAR and EXTENDER as TODO, so names whose non-first characters are combining marks that are not [:alpha:] (U+0301 in a decomposed "cafe\u0301", the Thai U+0E4C, the Devanagari virama U+094D, the Tamil U+0BCD) or the middle dot U+00B7 ("col\u00B7leccio") raised ParseException, although REXML::Element.new accepts these names and writes them. Add the combining marks that [:alpha:] does not already include, and the two Extender characters that are not [:alpha:].
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
NCNAME_STRleavesCOMBININGCHARandEXTENDERas TODOs, so an element or attribute name fails to parse when a later character is a combining mark that isn't[:alpha:], or the middle dot. REXML builds and writes these names itself, but can't read them back:xml.etree)café(decomposed é)Invalid attribute name: <́>col·leccio(Catalan middle dot)Invalid attribute name: <·leccio>เจมส์(Thai, U+0E4C)Invalid attribute name: <์>क्षेत्र(Devanagari virama U+094D)Invalid attribute name: <्षेत्र>பெயர்(Tamil virama U+0BCD)Invalid attribute name: <்>[4] NameChar includes CombiningChar and Extender. This change adds:
\p{M}) that[:alpha:]doesn't already include. Many vowel signs areAlphabetic, but tone marks, viramas and U+0300-U+036F aren't. Using an intersection keeps the character class free of duplicated ranges, so there is no-wwarning.[:alpha:].Names starting with a mark are still rejected, and no character that was accepted before is rejected now.
Tests:
test_combining_character_in_name(element and attribute name) andtest_extender_in_nameintest/parse/test_element.rb. Both fail before the change and pass after it.bundle exec rake testpasses (843 tests), as do the--enable-frozen-string-literalrun andbundle exec rake warning:error rdoc.ruby -wshows no new warnings.Performance: tag scanning with
TAG_PATTERNalone is 1-5% slower in a micro-benchmark. Parsing a 5000-element document with 2 attributes per element showed no measurable difference (best of 15 runs: 0.172s vs 0.168s).