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

JRuby SAX Parser fires incorrect events with mixed content #1388

Closed
DanElbert opened this issue Dec 1, 2015 · 2 comments
Closed

JRuby SAX Parser fires incorrect events with mixed content #1388

DanElbert opened this issue Dec 1, 2015 · 2 comments

Comments

@DanElbert
Copy link

Given the following program:

require 'nokogiri'

class TestParser < Nokogiri::XML::SAX::Document
  def start_element(name, attrs = [])
    puts "Element: #{name}"
  end

  def characters(str)
    puts "Content: #{str}"
  end

  def end_element(name)
    puts "/#{name}"
  end
end

xml = "<?xml version='1.0'?><outter>start<inner>middle</inner>end</outter>"

parser = Nokogiri::XML::SAX::Parser.new(TestParser.new)
parser.parse(xml)

I would expect the output to be:

Element: outter
Content: start
Element: inner
Content: middle
/inner
Content: end
/outter

Instead it produces:

Element: outter
Element: inner
Content: middle
/inner
Content: startend
/outter

Nokogiri 1.6.6.4 did not have this problem, but 1.6.7 does. MRI doesn't seem to exhibit the problem, either.

Please let me know if I can supply any more details.

Thank you.

@jvshahid
Copy link
Member

jvshahid commented Dec 9, 2015

verified on master

@flavorjones
Copy link
Member

This is fixed in current versions of Nokogiri. Closing.

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

No branches or pull requests

3 participants