Skip to content

Commit

Permalink
Remove REXML support altogether. Now we *really* need a new name?
Browse files Browse the repository at this point in the history
  • Loading branch information
Empact committed Oct 14, 2009
1 parent 7450645 commit bcf018e
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 156 deletions.
2 changes: 2 additions & 0 deletions History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

* major enhancements

* Add Nokogiri
* Remove previously deprecated functionality
* Remove REXML support
* Error on any unrecognized options
* Normalize hash declaration syntax:
* for :key => '@string', string is taken to be the :from argument
Expand Down
4 changes: 2 additions & 2 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ which may be used via _new_ construction as well as _from_xml_ construction.

== Selecting a parser

By default, ROXML will use Nokogiri if it is available, followed by LibXML or REXML. If you'd like to
By default, ROXML will use Nokogiri if it is available, followed by LibXML. If you'd like to
explicitly require one or the other, you may do the following:

module ROXML
XML_PARSER = 'nokogiri' # or 'libxml' or 'rexml'
XML_PARSER = 'nokogiri' # or 'libxml'
end
require 'roxml'

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ end
Dir['tasks/**/*.rake'].each { |t| load t }

task :default => [:test, :spec]
task :rexml => ['test:rexml', 'spec:rexml']
task :all => [:libxml, :nokogiri]
task :libxml => ['test:libxml', 'spec:libxml']
task :nokogiri => ['test:nokogiri', 'spec:nokogiri']

Expand Down
2 changes: 1 addition & 1 deletion lib/roxml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def self.included(base) # :nodoc:
end

module InstanceMethods # :nodoc:
# Returns a LibXML::XML::Node or a REXML::Element representing this object
# Returns an XML object representing this object
def to_xml(name = self.class.tag_name)
XML::Node.create(name.to_s).tap do |root|
self.class.roxml_attrs.each do |attr|
Expand Down
4 changes: 1 addition & 3 deletions lib/roxml/xml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ module ROXML
parsers.shift
retry
else
parsers_sentence = PREFERRED_PARSERS.to_sentence(:two_words_connector => ' or ', :last_word_connector => ', or ')
warn %{ROXML is unable to locate #{parsers_sentence} on your system, and so is falling back to the much slower REXML. It's best to check this out and get #{parsers_sentence} working if possible.}
XML_PARSER = 'rexml' # :nodoc:
raise "Could not load either nokogiri or libxml"
end
end
end
Expand Down
78 changes: 0 additions & 78 deletions lib/roxml/xml/parsers/rexml.rb

This file was deleted.

12 changes: 8 additions & 4 deletions roxml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Ben Woosley", "Zak Mandhro", "Anders Engstrom", "Russ Olsen"]
s.date = %q{2009-10-12}
s.date = %q{2009-10-14}
s.description = %q{ROXML is a Ruby library designed to make it easier for Ruby developers to work with XML.
Using simple annotations, it enables Ruby classes to be mapped to XML. ROXML takes care
of the marshalling and unmarshalling of mapped attributes so that developers can focus on
Expand Down Expand Up @@ -49,7 +49,7 @@ RESTful applications, Web Services, and XML-RPC.
"lib/roxml/hash_definition.rb",
"lib/roxml/xml.rb",
"lib/roxml/xml/parsers/libxml.rb",
"lib/roxml/xml/parsers/rexml.rb",
"lib/roxml/xml/parsers/nokogiri.rb",
"lib/roxml/xml/references.rb",
"roxml.gemspec",
"spec/definition_spec.rb",
Expand All @@ -64,11 +64,13 @@ RESTful applications, Web Services, and XML-RPC.
"spec/shared_specs.rb",
"spec/spec.opts",
"spec/spec_helper.rb",
"spec/support/libxml.rb",
"spec/support/nokogiri.rb",
"spec/xml/namespace_spec.rb",
"spec/xml/parser_spec.rb",
"tasks/rdoc.rake",
"tasks/rspec.rake",
"tasks/test.rake",
"test/bugs/rexml_bugs.rb",
"test/fixtures/book_malformed.xml",
"test/fixtures/book_pair.xml",
"test/fixtures/book_text_with_attribute.xml",
Expand Down Expand Up @@ -137,8 +139,10 @@ RESTful applications, Web Services, and XML-RPC.
"spec/roxml_spec.rb",
"spec/shared_specs.rb",
"spec/spec_helper.rb",
"spec/support/libxml.rb",
"spec/support/nokogiri.rb",
"spec/xml/namespace_spec.rb",
"spec/xml/parser_spec.rb",
"test/bugs/rexml_bugs.rb",
"test/mocks/dictionaries.rb",
"test/mocks/mocks.rb",
"test/support/fixtures.rb",
Expand Down
3 changes: 0 additions & 3 deletions spec/support/rexml.rb

This file was deleted.

33 changes: 2 additions & 31 deletions spec/xml/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,12 @@
it "should escape invalid characters on output to text node" do
node = ROXML::XML::Node.create("entities")
node.content = " < > ' \" & "
case ROXML::XML_PARSER
when 'libxml', 'nokogiri'
node.to_s.should == "<entities> &lt; &gt; ' \" &amp; </entities>"
when 'rexml'
node.to_s.should == "<entities> &lt; &gt; &apos; &quot; &amp; </entities>"
else
raise "Unrecognized Parser"
end
node.to_s.should == "<entities> &lt; &gt; ' \" &amp; </entities>"
end

it "should esape invalid characters for attribute name" do
node = ROXML::XML::Node.create("attr_holder")
node.attributes["entities"] = "\"'<>&"
case ROXML::XML_PARSER
when 'libxml', 'nokogiri'
node.to_s.should == %{<attr_holder entities="&quot;'&lt;&gt;&amp;"/>}
when 'rexml'
node.to_s.should == %{<attr_holder entities='&quot;&apos;&lt;&gt;&amp;'/>}
else
raise "Unrecognized Parser"
end
node.to_s.should == %{<attr_holder entities="&quot;'&lt;&gt;&amp;"/>}
end
end

describe ROXML::XML::Document do
describe "#save" do
context "with rexml parser" do
it "should defer to existing XMLDecl" do
if ROXML::XML_PARSER == 'rexml'
@doc = ROXML::XML::Document.new
@doc << REXML::XMLDecl.new('1.1')
@doc.save('spec/xml/decl_test.xml')
ROXML::XML::Parser.parse(File.read('spec/xml/decl_test.xml')).to_s.should == ROXML::XML::Parser.parse(%{<?xml version="1.1"?>}).to_s
end
end
end
end
end
2 changes: 1 addition & 1 deletion tasks/rspec.rake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Spec::Rake::SpecTask.new(:spec) do |spec|
end

namespace :spec do
[:rexml, :libxml, :nokogiri].each do |parser|
[:libxml, :nokogiri].each do |parser|
desc "Spec ROXML under the #{parser} parser"
Spec::Rake::SpecTask.new(parser) do |spec|
spec.libs << 'lib' << 'spec' << 'examples'
Expand Down
8 changes: 0 additions & 8 deletions tasks/test.rake
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ namespace :test do
Rake::Task["test"].invoke
end

desc "Test ROXML under the REXML parser"
task :rexml do
module ROXML
XML_PARSER = 'rexml'
end
Rake::Task["test"].invoke
end

desc "Runs tests under RCOV"
task :rcov do
system "rcov -T --no-html -x '^/' #{FileList['test/unit/*_test.rb']}"
Expand Down
15 changes: 0 additions & 15 deletions test/bugs/rexml_bugs.rb

This file was deleted.

8 changes: 0 additions & 8 deletions test/unit/xml_namespace_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ def test_default_namespace_is_applied_to_in_element
end
end

def test_that_rexml_follows_nameless_default_namespace
require 'rexml/document'
xml = REXML::Document.new(
'<container xmlns="http://fakenamespace.org"><node>Yeah, content</node></container>')

assert_equal "Yeah, content", xml.root.get_elements('node').first.text
end

def test_default_namespace_on_root_node_should_be_found
require 'libxml'
xml = LibXML::XML::Parser.string(
Expand Down
2 changes: 1 addition & 1 deletion website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h1><a href="http://github.com/Empact/roxml">roxml</a>
<span class="small">by <a href="http://github.com/Empact">Empact</a></small></h1>

<div class="description">
ROXML is a module for binding Ruby classes to XML. It supports custom mapping and bidirectional marshaling between Ruby and XML using annotation-style class methods. ROXML supports the LibXML and REXML XML processors.
ROXML is a module for binding Ruby classes to XML. It supports custom mapping and bidirectional marshaling between Ruby and XML using annotation-style class methods. ROXML supports the Nokogiri and LibXML XML processors.
</div>

<p>We may not want to work with XML, but we don't always get to pick just how our data comes. If you do need to do serious work with XML, ROXML is here to make it nice.
Expand Down

0 comments on commit bcf018e

Please sign in to comment.