sax_stream 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,8 @@ module SaxStream
2
2
  class ImportError < Exception; end
3
3
 
4
4
  class ProgramError < ImportError; end
5
- class UnexpectedNode < ImportError; end
6
- class UnexpectedAttribute < ImportError; end
5
+
6
+ class ParsingError < ImportError; end
7
+ class UnexpectedNode < ParsingError; end
8
+ class UnexpectedAttribute < ParsingError; end
7
9
  end
@@ -21,6 +21,10 @@ module SaxStream
21
21
  RUBY
22
22
  module_eval(code)
23
23
  end
24
+
25
+ def error(string)
26
+ raise ParsingError.new(string)
27
+ end
24
28
  end
25
29
  end
26
30
  end
@@ -10,9 +10,9 @@ module SaxStream
10
10
  @sax_handler = Internal::SaxHandler.new(collector, mappers)
11
11
  end
12
12
 
13
- def parse_stream(io_stream)
13
+ def parse_stream(io_stream, encoding = 'UTF-8')
14
14
  parser = Nokogiri::XML::SAX::Parser.new(@sax_handler)
15
- parser.parse(io_stream)
15
+ parser.parse_io(io_stream, encoding)
16
16
  end
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sax_stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-12 00:00:00.000000000 Z
12
+ date: 2012-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &70349513367200 !ruby/object:Gem::Requirement
16
+ requirement: &70307155091780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.5.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70349513367200
24
+ version_requirements: *70307155091780
25
25
  description: A streaming XML parser which builds objects and passes them to a collecter
26
26
  as they are ready. Based upon Nokogiri SAX parsing functionality.
27
27
  email: