Skip to content

Instantly share code, notes, and snippets.

@statonjr
Created August 17, 2012 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save statonjr/3380575 to your computer and use it in GitHub Desktop.
Save statonjr/3380575 to your computer and use it in GitHub Desktop.
Nokogiri Error
# Ruby 1.9.3-p194
[2] pry(main)> xslt = Nokogiri::XSLT(File.read('features/support/test_data/test.xslt'))
=> #<Nokogiri::XSLT::Stylesheet:0x007f841a850228>
# JRuby 1.6.7.2 in 1.9 mode
[2] pry(main)> xslt = Nokogiri::XSLT(File.read('features/support/test_data/test.xslt'))
=> #<Nokogiri::XSLT::Stylesheet:0x00000000>
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="order">
<xsl:value-of select="items"/>
</xsl:template>
</xsl:stylesheet>
@yokolet
Copy link

yokolet commented Aug 19, 2012

It looks JRuby + pry combination problem.

irb(main):002:0> require 'nokogiri'=> true
irb(main):003:0> p xslt = Nokogiri::XSLT(File.read('/Users/yoko/Documents/workspace/Canna/src/snippet/xslt_print.xml'))
#<Nokogiri::XSLT::Stylesheet:0x4d17140b>
=> #<Nokogiri::XSLT::Stylesheet:0x4d17140b>

while

[1] pry(main)> require 'nokogiri'
=> true
[2] pry(main)> p xslt = Nokogiri::XSLT(File.read('/Users/yoko/Documents/workspace/Canna/src/snippet/xslt_print.xml'))
#<Nokogiri::XSLT::Stylesheet:0x37bbea67>
=> #<Nokogiri::XSLT::Stylesheet:0x00000000>

From this result, pure Java Nokogiri looks working correctly. I'm suspecting pry's JRuby support, or some method pry uses doesn't work on JRuby correctly.

Do you know what part of pry releated to the wrong result?

@ConradIrwin
Copy link

This is a bug in the PP library on jruby:

[34] pry(main)> p xslt;
#<Nokogiri::XSLT::Stylesheet:0x5cf64dcd>
[35] pry(main)> pp xslt;
#<Nokogiri::XSLT::Stylesheet:0x00000000>

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