Empact/roxml — Issue #38: After marshalling/unmarshalling nil is frozen
Author: warnergodfrey
Created: 2011-12-22 03:14:57+00:00
State: open

Marshalling or unmarshalling an XML document using ROXML is freezing nil.

I have included a failing spec that demonstrates the issue and a copy of the Gemfile and rvm config that was used to run the spec.

frozen_nil_spec.rb

```ruby
require 'rubygems'
require 'roxml'

describe 'roxml' do
let(:xml_file) { File.open(File.expand_path('library.xml', File.dirname(__FILE__))) }

context 'before unmarshalling an XML document' do
it { nil.should_not be_frozen }
end

context 'after unmarshalling an XML document' do
before do
lib = Library.from_xml(xml_file)
end

it { nil.should_not be_frozen }
end
end

class Book
include ROXML

xml_accessor :isbn, :from => "@ISBN" # attribute with name 'ISBN'
xml_accessor :title
xml_accessor :description, :cdata => true # text node with cdata protection
xml_accessor :author
end

class Library
include ROXML

xml_accessor :name, :from => "NAME", :cdata => true
xml_accessor :books, :as => [Book] # by default roxml searches for books for in child nodes, then, if none are present, in ./books/book children
end
```

library.xml

```xml

Favorite Books

The PickAxe

Best Ruby book out there!
David Thomas, Andrew Hunt, Dave Thomas

```

Gemfile

```
source 'http://rubygems.org'

gem 'roxml', '3.2.0'
gem 'rspec', '2.6.0'
gem 'i18n'
```

Gemfile.lock

```
GEM
remote: http://rubygems.org/
specs:
activesupport (3.1.3)
multi_json (~> 1.0)
diff-lcs (1.1.3)
i18n (0.6.0)
multi_json (1.0.4)
nokogiri (1.5.0)
roxml (3.2.0)
activesupport (>= 2.3.0)
nokogiri (>= 1.3.3)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)

PLATFORMS
ruby

DEPENDENCIES
i18n
roxml (= 3.2.0)
rspec (= 2.6.0)
```

.rvmrc

```
rvm 1.9.2-p290@roxml --create
```