Ticket #81 (closed defect: fixed)

Opened 2 years ago

Last modified 21 months ago

Strange XML serialization bug.

Reported by: aquasync Owned by: ser
Priority: high Milestone: 3.1.7
Component: DOM Version: 3.1.3
Severity: critical Keywords:
Cc: Ruby version: 1.8.4
Operating system: Windows

Description (last modified by ser) (diff)

This is a pretty strange bug.

Essentially, when saving my xml out to a file, using the .to_s method of REXML::Document, I'm getting elements where the tag name includes the xpath index number (such as <table:table-row[2] .... />) (I'm processing some .odt files.)

I narrowed down the changes made to my code to make it work again. Disabling my call to .xpath (REXML::Element), caused it to no longer occur. That seemed odd, so I fiddled further, and eventually found that changing the line:

rv << "#{idx+1}" to rv += "#{idx+1}"

in rexml/element.rb _to_xpath_helper, made it work. Which defies my understanding, perhaps << is inplace, and is modifiying expanded_name?

Anyway, let me know if you want more info/explanation.


I'm using REXML 3.1.3, and have the same problem with ruby 1.8.4 mingw32, and cygwin.

Change History

Changed 2 years ago by ser

  • milestone changed from 3.1.6 to 3.1.7

Changed 21 months ago by ser

  • status changed from new to closed
  • resolution set to fixed
  • description modified (diff)

The source code shows that the rv variable is a clone of the expanded node name, so in-place modification shouldn't affect the results. It should have been fixed by changeset:1137, and should be fine in 3.1.4.

If this is still happening I'll re-open this; if so, please post a test case.

Note: See TracTickets for help on using tickets.