# REXML, rake aborted! Text is not a module

**URL:** <https://www.ruby-forum.com/t/rexml-rake-aborted-text-is-not-a-module/188960>\
**Category:** Rails\
**Created:** [May 21, 2010, 4:01am UTC](https://www.ruby-forum.com/t/rexml-rake-aborted-text-is-not-a-module/188960 "2010-05-21T04:01:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yetanothergeek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/8e8cbc/32.png) [@yetanothergeek](https://www.ruby-forum.com/u/yetanothergeek)\
**Post date:** [May 21, 2010, 4:01am UTC](https://www.ruby-forum.com/t/rexml-rake-aborted-text-is-not-a-module/188960/1 "2010-05-21T04:01:57Z")

</div>

I am writing a rake task for my rails app to parse data from an XML and  
keep getting the error:  
rake aborted!  
Text is not a module

here are the contents of my lib/tasks/xml\_parse.rake  
#--------------------------------  
require ‘rexml/document’  
include REXML

namespace :xml do

task :parse =\> :environment do  
puts “hello”  
#commented out everything else until it works  
#…  
end  
end  
#----------------------------------

The output looks like this…

#----------------------------------

imac:HAA-TMS chris$ rake xml:parse --trace  
(in /Users/chris/Projects/HAA-TMS)  
hello1  
\*\* Invoke xml:parse (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
rake aborted!  
Text is not a module  
/opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.3.5/lib/action\_mailer.rb:52  
/opt/local/lib/ruby/vendor\_ruby/1.8/rubygems/custom\_require.rb:31:in  
`gem_original_require' /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in`require’  
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active\_support/dependencies.rb:156:in  
`require' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in`new\_constants\_in’  
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active\_support/dependencies.rb:156:in  
`require' /Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:268:in`require\_frameworks’  
/Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:268:in  
`each' /Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:268:in`require\_frameworks’  
/Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:134:in  
`process' /Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in`send’  
/Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in  
`run' /Users/chris/Projects/HAA-TMS/config/environment.rb:5 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in`gem\_original\_require’  
/opt/local/lib/ruby/vendor\_ruby/1.8/rubygems/custom\_require.rb:31:in  
`require' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in`require’  
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active\_support/dependencies.rb:521:in  
`new_constants_in' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in`require’  
/Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/tasks/misc.rake:4  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in`execute’  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in`execute’  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in  
`invoke_with_call_chain' /opt/local/lib/ruby/1.8/monitor.rb:242:in`synchronize’  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in  
`invoke_with_call_chain' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in`invoke\_prerequisites’  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in`invoke\_prerequisites’  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in  
`invoke_with_call_chain' /opt/local/lib/ruby/1.8/monitor.rb:242:in`synchronize’  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in  
`invoke_with_call_chain' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in`invoke’  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in  
`invoke_task' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in`top\_level’  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in`top\_level’  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in  
`standard_exception_handling' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in`top\_level’  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in`standard\_exception\_handling’  
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 /opt/local/bin/rake:19:in`load’  
/opt/local/bin/rake:19  
#----------------------------------

The only line trace is spitting out from my code is  
/Users/chris/Projects/HAA-TMS/config/environment.rb:5  
…and that line is the…  
Rails::Initializer.run do |config|

The rake task will run fine if I remove the reference “=\> :environment”  
from the task declaration but I need that so I can write the XML data to  
a model in my application.

Also I’m using ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10] on  
snow leopard with rubygems 1.3.5 just in case that helps

If you’ve read this far, I really appreciate it.

Many thanks in advance,

Chris

---

<div class="post-metadata">

**Author:** ![yetanothergeek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/8e8cbc/32.png) [@yetanothergeek](https://www.ruby-forum.com/u/yetanothergeek)\
**Post date:** [May 21, 2010, 10:43am UTC](https://www.ruby-forum.com/t/rexml-rake-aborted-text-is-not-a-module/188960/2 "2010-05-21T10:43:19Z")

</div>

Switched from REXML to nokogiri. Any solution at this point is purely  
academic…
