Permalink
Browse files

adding pull parser

  • Loading branch information...
1 parent 68461e2 commit 36de4bcdeff8c9fa7d058a68197f2d64733128d7 @tenderlove committed Aug 2, 2008
Showing with 8 additions and 5 deletions.
  1. +8 −5 lib/earworm.rb
View
13 lib/earworm.rb
@@ -2,7 +2,7 @@
require 'tempfile'
require 'earworm_lib'
require 'rexml/document'
-require 'rexml/parsers'
+require 'rexml/parsers/pullparser'
class Earworm
VERSION = '0.0.1'
@@ -47,10 +47,13 @@ def identify(options = {})
'enc' => '',
}
end
- xml = REXML::Document.new(
- Net::HTTP.post_form(URI.parse(URL), post_opts).body
- )
- p xml
+ xml = Net::HTTP.post_form(URI.parse(URL), post_opts).body
+ puts xml
+ require 'pp'
+ parser = REXML::Parsers::PullParser.new(xml)
+ while parser.has_next?
+ pp parser.pull
+ end
end
def fingerprint(filename)

0 comments on commit 36de4bc

Please sign in to comment.