Skip to content

REXML 3.4.5 - 2026-12-04

Latest

Choose a tag to compare

@github-actions github-actions released this 04 Dec 11:39
b7201c2

Incompatible changes

  • Dropped support for Ruby 2.5 (Ruby 2.6 or later is now required)

  • Removed unused REXML::QuickPath (rexml/quickpath)

    • GH-250
    • GH-362
    • Patch by Sutou Kouhei
    • Reported by NAITOH Jun
  • Changed REXML::Functions to a REXML::FunctionsClass instance for thread safety and removed unused REXML::Functions.text, .processing_instruction, .variables, and .namespace_context

  • Switched available XPath function checks from a denylist to an allowlist

    • Monkey-patching custom XPath functions onto REXML::Functions is no longer supported
    • GH-369
    • Patch by tomoya ishida, Sutou Kouhei
  • Stopped falling back to XPath.match for unregistered XPath functions in FunctionsClass#send (now returns [])

    • GH-364
    • Patch by tomoya ishida
  • Changed XPath to always return node-sets in document order

    • Changes the returned order of XPath.match / XPath.first for reverse axes such as ancestor:: and preceding:: to match the XPath 1.0 specification
    • GH-319
    • GH-320
    • GH-356
    • Patch by tomoya ishida, NAITOH Jun
    • Reported by tomoya ishida
  • Stopped matching prefixed attributes by their local name only

    • Attributes#[], #get_attribute, and Element#attribute no longer return x:b for "b"; use the qualified name ("x:b") or a namespace
    • Attributes#keys now returns qualified names (e.g. "xmlns:x", "x:b")
    • GH-335
    • Patch by tomoya ishida
  • Validated XPath variable values and fixed id() return value

    • Unsupported variable value types now raise TypeError, predicates on non-nodeset variables return [], and unimplemented id() returns [] instead of nil
    • GH-15
    • GH-342
    • Patch by tomoya ishida
    • Reported by Sutou Kouhei
  • Removed non-working XPath namespace:: axis handling

    • Emits a warning and returns [] instead of raising NoMethodError
    • GH-323
    • Patch by tomoya ishida
  • Changed XPath mod operator to use truncating remainder (Numeric#remainder) and return NaN for mod 0

    • Matches XPath 1.0 for negative operands and no longer raises ZeroDivisionError for a zero divisor
    • GH-385
    • GH-386
    • Patch by Sourya Singh
    • Reported by bardrop
  • Returned Infinity / NaN from XPath string(), floor(), and ceiling() instead of raising FloatDomainError

Improvements

  • Improved performance

  • Made REXML Ractor-compatible

    • GH-344
    • Patch by John Hawthorn
  • Deprecated unused REXML::Text.read_with_substitution (use REXML::Text.unnormalize instead)

    • GH-363
    • Patch by Sutou Kouhei
  • Supported parenthesized XPath expressions and abbreviate of parentheses

  • Supported string-length() XPath function without an argument

  • Accepted processing instructions in the internal DTD subset

  • Accepted non-ASCII names, combining characters, and extenders in DOCTYPE, processing instructions, DTD declarations, elements, and attributes

  • Accepted any XML whitespace around XPath operators and, or, div, and mod

    • GH-399
    • Patch by Moksh Upadhyay
  • Rejected underscored XPath function names (e.g. local_name()) in strict mode (default mode keeps the alias for backward compatibility)

    • GH-352
    • GH-366
    • Patch by JinHyuk Sung
    • Reported by tomoya ishida
  • Improved documentation

Fixes

  • Fixed an issue when executing REXML::Parsers::SAX2Parser#parse without specifying #listen

  • Fixed infinite entity expansion by detecting circular references

    • Circular entity references now raise REXML::ParseException instead of SystemStackError
    • GH-312
    • Patch by NAITOH Jun
  • Fixed parsing XPath expressions with string literals containing parentheses and brackets

    • GH-318
    • Patch by tomoya ishida
  • Fixed XPath normalize-space() function

    • GH-324
    • Patch by tomoya ishida
  • Fixed XPath functions not to return a primitive value wrapped in an array

    • GH-326
    • Patch by tomoya ishida
  • Fixed XPath self axis nodeset position

    • GH-336
    • Patch by tomoya ishida
  • Fixed XMLDecl being included in XPath descendant::node() results

    • GH-331
    • GH-341
    • Patch by tomoya ishida
    • Reported by tomoya ishida
  • Fixed XPath name functions (name(), local-name(), namespace-uri())

    • Uses the first node in document order without skipping unnamed nodes (e.g. name(root/node()) returns "" instead of "node" when a text node comes first)
    • GH-343
    • Patch by tomoya ishida, NAITOH Jun
  • Fixed substring-after() XPath function not to use Regexp match

    • GH-355
    • Patch by Vít Ondruch
  • Fixed REXML::Element#attribute when a namespace URI has multiple bindings

    • GH-346
    • GH-357
    • Patch by JinHyuk Sung
    • Reported by tomoya ishida
  • Avoided stack exhaustion in REXML::Formatters::Default#write_element for deeply nested documents

  • Explicitly required "set" in xpath_parser.rb

    • GH-361
    • Patch by tomoya ishida
  • Stopped substituting entities with an empty value

    • Entities declared with an empty value are no longer inserted between every character during text/attribute normalization
    • GH-370
    • Patch by NAITOH Jun
  • Fixed REXML::Formatters::Pretty mutating text nodes while pretty printing

  • Rejected invalid character references in entity expansion

    • Invalid XML character references inside entity values now raise REXML::ParseException
    • GH-372
    • Patch by Sutou Kouhei
  • Fixed XPath lang() not to match a language prefix that is not a sublanguage

  • Fixed RELAX NG validation of documents with XML declarations

  • Fixed XPath substring() with a start before the first character and round() for negative halves

    • e.g. substring('12345', 0) now returns "12345" instead of "1234", and round(-2.5) returns -2 instead of -3
    • GH-382
    • Patch by bardrop
  • Fixed XPath comparisons between a node-set and a boolean, number, or string

    • Fixes reversed relational operators when the node-set is on the right (e.g. 10 > @price), boolean comparisons, and string comparisons
    • GH-383
    • Patch by bardrop
  • Preserved whitespace before word operators after XPath predicates

  • Fixed XPath unary minus parsing with leading or separating spaces

    • Unary minus without an operand (e.g. "-", " - - ") now raises REXML::ParseException
    • GH-393
    • Patch by NAITOH Jun
  • Renamed the XPath test fixture xp.tst to xp.txt

    • GH-394
    • Patch by botamochi0x12
  • Formatted small floats without scientific notation in XPath string()

    • e.g. string(0.00001) now returns "0.00001" instead of "1.0e-05"
    • GH-395
    • Patch by Moksh Upadhyay
  • Fixed XPath parsing of expressions and literals containing line breaks

    • GH-397
    • Patch by Moksh Upadhyay
  • Fixed XPath matching for the predefined xml namespace and empty strings

    • GH-396
    • GH-398
    • Patch by Akshay Kumar Sharma
    • Reported by Dickson Wu

Thanks

  • NAITOH Jun

  • Sutou Kouhei

  • tomoya ishida

  • Burdette Lamar

  • John Hawthorn

  • Sai Asish Y

  • Vít Ondruch

  • JinHyuk Sung

  • KBS

  • Wleeaf

  • FFspiky

  • Sourya Singh

  • Gal Be

  • bardrop

  • Moksh Upadhyay

  • Akshay Kumar Sharma

  • botamochi0x12

  • Hiroya Fujinami

  • Brian

  • pboling

  • gemmaro

  • Dickson Wu