8000 Comparing v3.3.5...v3.3.6 · ruby/rexml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ruby/rexml
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.3.5
Choose a base ref
...
head repository: ruby/rexml
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.3.6
Choose a head ref
  • 15 commits
  • 17 files changed
  • 3 contributors

Commits on Aug 12, 2024

  1. Bump version

    kou committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    e14847c View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2024

  1. 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>
    vikiv480 and kou authored Aug 16, 2024
    Configuration menu
    Copy the full SHA
    2f019f9 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2024

  1. 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 = "&lt;p&gt;#{'A' * 10_240}&lt;/p&gt;"
    
    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>
    3 people authored Aug 17, 2024
    Configuration menu
    Copy the full SHA
    1c76dbb View commit details
    Browse the repository at this point in the history
  2. 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.)
    naitoh authored Aug 17, 2024
    Configuration menu
    Copy the full SHA
    c8110b4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    790ad5c View commit details
    Browse the repository at this point in the history
  4. Use loop instead of recursive call for Element#root

    It's for performance and avoiding stack level too deep.
    kou committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    6422fa3 View commit details
    Browse the repository at this point in the history
  5. Use loop instead of recursive call for Element#namespace

    It's for performance and avoiding stack level too deep.
    kou committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    fdbffe7 View commit details
    Browse the repository at this point in the history
  6. test: fix indent

    kou committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    df3a0cc View commit details
    Browse the repository at this point in the history
  7. test: fix indent

    kou committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    6e00a14 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    35e1681 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2b47b16 View commit details
    Browse the repository at this point in the history
  10. parser: keep the current namespaces instead of stack of Set

    It improves namespace resolution performance for deep element.
    kou committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    cb15858 View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2024

  1. 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>&lt;P&gt; &lt;I&gt; &lt;B&gt; Text &lt;/B&gt; &lt;/I&gt;</a><b>test&#8482;</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™
    ```
    naitoh authored Aug 21, 2024
    Configuration menu
    Copy the full SHA
    6109e01 View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2024

  1. parser tree: improve namespace conflicted attribute check performance

    It was slow for deep element.
    
    Reported by l33thaxor. Thanks!!!
    kou committed Aug 22, 2024
    3 Configuration menu
    Copy the full SHA
    7cb5eae View commit details
    Browse the repository at this point in the history
  2. Add 3.3.6 entry

    kou committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    95871f3 View commit details
    Browse the repository at this point in the history
Loading
0