-
Notifications
You must be signed in to change notification settings - Fork 76
Comparing changes
Open a pull request
base repository: ruby/rexml
base: v3.3.5
head repository: ruby/rexml
compare: v3.3.6
- 15 commits
- 17 files changed
- 3 contributors
Commits on Aug 12, 2024
-
Configuration menu - View commit details
-
Copy full SHA for e14847c - Browse repository at this point
Copy the full SHA e14847cView commit details
Commits on Aug 16, 2024
-
Improve
BaseParser#unnormalize
(#194)The current implementation of `#unnormalize` iterates over matched entity references that already has been substituted. With these changes we will reduce the number of redundant calls to `rv.gsub!`. * Reject filtered matches earlier in the loop * Improve `#unnormalize` by removing redundant calls to `rv.gsub!` * Improve `entity_expansion_limit` tests --- Example: ```ruby require "rexml/parsers/baseparser" entity_less_than = "<" entitiy_length = 100 filler_text = "A" filler_length = 100 feed = "#{entity_less_than * entitiy_length}#{filler_text * filler_length}" base_parser = REXML::Parsers::BaseParser.new("") base_parser.unnormalize(feed) # => "<" * 100 + "A" * 100 ``` Before this PR, the example above would require 100 iterations. After this PR, 1 iteration. --------- Co-author 10000 ed-by: Sutou Kouhei <kou@clear-code.com>
Configuration menu - View commit details
-
Copy full SHA for 2f019f9 - Browse repository at this point
Copy the full SHA 2f019f9View commit details
Commits on Aug 17, 2024
-
Fix RuntimeError in
REXML::Parsers::BaseParser
for valid feeds (#199)GitHub: fix GH-198 Change `#entity` to not match against default entities After this change, the following example will not raise a RuntimeError: ```ruby # rexml/refactor_entity_example.rb $LOAD_PATH.unshift(File.expand_path("lib")) require "rexml/parsers/baseparser" valid_feed = "<p>#{'A' * 10_240}</p>" base_parser = REXML::Parsers::BaseParser.new("") base_parser.unnormalize(valid_feed) # => "<p>" + "A" * 10_240 + "</p>" ``` Default entities now gets substituted by this block instead https://github.com/ruby/rexml/blob/e14847cee53d26eb162ad786ba12e3cd7a86fce0/lib/rexml/parsers/baseparser.rb#L560-L563 --------- Co-authored-by: Sutou Kouhei <kou@clear-code.com> Co-authored-by: NAITOH Jun <naitoh@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 1c76dbb - Browse repository at this point
Copy the full SHA 1c76dbbView commit details -
Fix to not allow parameter entity references at internal subsets (#191)
## Why? In the internal subset of DTD, references to parameter entities are not allowed within markup declarations. See: https://www.w3.org/TR/xml/#wfc-PEinInternalSubset > Well-formedness constraint: PEs in Internal Subset > In the internal DTD subset, parameter-entity references MUST NOT occur within markup declarations; they may occur where markup declarations can occur. (This does not apply to references that occur in external parameter entities or to the external subset.)
Configuration menu - View commit details
-
Copy full SHA for c8110b4 - Browse repository at this point
Copy the full SHA c8110b4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 790ad5c - Browse repository at this point
Copy the full SHA 790ad5cView commit details -
Use loop instead of recursive call for Element#root
It's for performance and avoiding stack level too deep.
Configuration menu - View commit details
-
Copy full SHA for 6422fa3 - Browse repository at this point
Copy the full SHA 6422fa3View commit details -
Use loop instead of recursive call for Element#namespace
It's for performance and avoiding stack level too deep.
Configuration menu - View commit details
-
Copy full SHA for fdbffe7 - Browse repository at this point
Copy the full SHA fdbffe7View commit details -
Configuration menu - View commit details
-
Copy full SHA for df3a0cc - Browse repository at this point
Copy the full SHA df3a0ccView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6e00a14 - Browse repository at this point
Copy the full SHA 6e00a14View commit details -
Configuration menu - View commit details
-
Copy full SHA for 35e1681 - Browse repository at this point
Copy the full SHA 35e1681View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2b47b16 - Browse repository at this point
Copy the full SHA 2b47b16View commit details -
parser: keep the current namespaces instead of stack of Set
It improves namespace resolution performance for deep element.
Configuration menu - View commit details
-
Copy full SHA for cb15858 - Browse repository at this point
Copy the full SHA cb15858View commit details
Commits on Aug 21, 2024
-
Fix a bug that Stream parser doesn't expand the user-defined entity r…
…eferences for "text" (#200) ## Why? Pull parser expands character references and predefined entity references, but doesn't expand user-defined entity references. ## Change - text_stream_unnormalize.rb ``` $LOAD_PATH.unshift(File.expand_path("lib")) require 'rexml/document' require 'rexml/parsers/sax2parser' require 'rexml/parsers/pullparser' require 'rexml/parsers/streamparser' require 'rexml/streamlistener' xml = <<EOS <!DOCTYPE foo [ <!ENTITY la "1234"> <!ENTITY lala "--&la;--"> <!ENTITY lalal "&la;&la;"> ]><root><la>&la;</la><lala>&lala;</lala><a><P> <I> <B> Text </B> </I></a><b>test™</b></root> EOS class StListener include REXML::StreamListener def text(text) puts text end end puts "REXML(DOM)" REXML::Document.new(xml).elements.each("/root/*") {|element| puts element.text} puts "" puts "REXML(Pull)" parser = REXML::Parsers::PullParser.new(xml) while parser.has_next? event = parser.pull case event.event_type when :text puts event[1] end end puts "" puts "REXML(Stream)" parser = REXML::Parsers::StreamParser.new(xml, StListener.new).parse puts "" puts "REXML(SAX)" sax = REXML::Parsers::SAX2Parser.new(xml) sax.listen(:characters) {|x| puts x } sax.parse ``` ## Before (master) ``` $ ruby text_stream_unnormalize.rb REXML(DOM) 1234 --1234-- <P> <I> <B> Text </B> </I> test™ REXML(Pull) 1234 --1234-- <P> <I> <B> Text </B> </I> test™ REXML(Stream) &la; #<= This &lala; #<= This <P> <I> <B> Text </B> </I> test™ REXML(SAX) 1234 --1234-- <P> <I> <B> Text </B> </I> test™ ``` ## After(This PR) ``` $ ruby text_stream_unnormalize.rb REXML(DOM) 1234 --1234-- <P> <I> <B> Text </B> </I> test™ REXML(Pull) 1234 --1234-- <P> <I> <B> Text </B> </I> test™ REXML(Stream) 1234 --1234-- <P> <I> <B> Text </B> </I> test™ REXML(SAX) 1234 --1234-- <P> <I> <B> Text </B> </I> test™ ```
Configuration menu - View commit details
-
Copy full SHA for 6109e01 - Browse repository at this point
Copy the full SHA 6109e01View commit details
Commits on Aug 22, 2024
-
parser tree: improve namespace conflicted attribute check performance
It was slow for deep element. Reported by l33thaxor. Thanks!!!
3Configuration menu - View commit details
-
Copy full SHA for 7cb5eae - Browse repository at this point
Copy the full SHA 7cb5eaeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 95871f3 - Browse repository at this point
Copy the full SHA 95871f3View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v3.3.5...v3.3.6