-
Notifications
You must be signed in to change notification settings - Fork 74
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
strip error #67
Comments
Hey @MortalCatalyst, I think you might be doing this a little wrong. Maybe it makes sense for Nori to raise a better error here, so it's more obvious why this is failing? |
OK so I just need to do it more like this MAINxml_data = get_file_as_string 'Pizza.hbm.xml' print out the stringputs xml_data Which I got from here http://alvinalexander.com/blog/post/ruby/ruby-method-read-in-entire-file-as-string |
Ah, even better you could probably use the builtin method require 'nori'
xml_data = File.read('Pizza.hbm.xml')
puts xml_data
hash = Nori.new.parse(xml_data)
puts hash.inspect Hope this helps! |
I have created a nokogiri document 'doc' each time I attempt to parse it with Nori I get an error.
'[63] pry(main)> parser = Nori.new
=> #<Nori:0x00000004f34b30
@options=
{:strip_namespaces=>false,
:delete_namespace_attributes=>false,
:convert_tags_to=>nil,
:convert_attributes_to=>nil,
:advanced_typecasting=>true,
:convert_dashes_to_underscores=>true,
:parser=>:nokogiri}>
[64] pry(main)> parser.parse(@doc)
NoMethodError: undefined method
strip' for #<Nokogiri::XML::Document:0x00000002103ae0> from /var/lib/gems/1.9.1/gems/nori-2.4.0/lib/nori.rb:42:in
parse'[65] pry(main)> parser.parse(doc)
NoMethodError: undefined method
strip' for #<Nokogiri::XML::Document:0x25decf4 name="document"> from /var/lib/gems/1.9.1/gems/nori-2.4.0/lib/nori.rb:42:in
parse'and even with a tiny called tiny.xml
[68] pry(main)> newdoc = Nokogiri::XML("tiny.xml")
=> #(Document:0x24ed034 { name = "document" })
[69] pry(main)> parser.parse(newdoc)
NoMethodError: undefined method
strip' for #<Nokogiri::XML::Document:0x24ed034 name="document"> from /var/lib/gems/1.9.1/gems/nori-2.4.0/lib/nori.rb:42:in
parse'[70] pry(main)>
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: