Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent handling of "empty" elements. #46

Open
trevorrowe opened this issue Mar 5, 2015 · 1 comment
Open

Inconsistent handling of "empty" elements. #46

trevorrowe opened this issue Mar 5, 2015 · 1 comment

Comments

@trevorrowe
Copy link
Contributor

Given the following Gemfile

source 'https://rubygems.org'

gem 'multi_xml'
gem 'nokogiri'
gem 'ox'
gem 'libxml-ruby'

Given the following Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    libxml-ruby (2.8.0)
    mini_portile (0.6.2)
    multi_xml (0.5.5)
    nokogiri (1.6.6.2)
      mini_portile (~> 0.6.0)
    ox (2.1.8)

PLATFORMS
  ruby

DEPENDENCIES
  libxml-ruby
  multi_xml
  nokogiri
  ox

And the following script:

require 'bundler/setup'
require 'multi_xml'
require 'libxml'
require 'ox'
require 'nokogiri'

xml = '<xml> </xml>'

[:nokogiri, :rexml, :ox, :libxml].each do |parser|
  MultiXml.parser = parser
  puts "#{parser}: #{MultiXml.parse(xml).inspect}"
end

I get the following output:

nokogiri: {"xml"=>nil}
rexml: {"xml"=>" "}
ox: {"xml"=>" "}
libxml: {"xml"=>nil}
@trevorrowe
Copy link
Contributor Author

I'm not 100% positive, but I suspect the expected behavior is to return " ", single space character, from all four parsers. I would be equally okay if they all returned nil as well. I'm most interested in them being consistent. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant