ox 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ox might be problematic. Click here for more details.

data/README.md CHANGED
@@ -26,19 +26,20 @@ A fast XML parser and Object marshaller as a Ruby gem.
26
26
 
27
27
  ## <a name="release">Release Notes</a>
28
28
 
29
- ### Release 1.4.3
29
+ ### Release 1.4.4
30
30
 
31
- - In tolerant mode attribute values can now be surrounded by single quotes.
32
- - In tolerant mode attribute values can now be without quotes as long as they do not contain spaces and are followed by a white space character.
31
+ - Fixed off by 1 error that caused reallocation error for long XML messages.
33
32
 
34
33
  ## <a name="description">Description</a>
35
34
 
36
35
  Optimized XML (Ox), as the name implies was written to provide speed optimized
37
- XML handling. It was designed to be an alternative to Nokogiri in generic XML
38
- parsing and as an alternative to Marshal for Object serialization.
36
+ XML handling. It was designed to be an alternative to Nokogiri and other Ruby
37
+ XML parsers in generic XML parsing and as an alternative to Marshal for Object
38
+ serialization.
39
39
 
40
- Unlike Nokogiri Ox is self contained. Ox uses nothing other than standard C
41
- libraries so version issues with libXml are not an issue.
40
+ Unlike some other Ruby XML parsers, Ox is self contained. Ox uses nothing
41
+ other than standard C libraries so version issues with libXml are not an
42
+ issue.
42
43
 
43
44
  Marshal uses a binary format for serializing Objects. That binary format
44
45
  changes with releases making Marshal dumped Object incompatible between some
@@ -48,9 +49,9 @@ used for inspecting the serialize Object. Ox on the other hand uses human
48
49
  readable XML. Ox also includes options that allow strict, tolerant, or a mode
49
50
  that automatically defines missing classes.
50
51
 
51
- It is possible to write an XML serialization gem with Nokogiri but writing
52
- such a package in Ruby results in a module significantly slower than
53
- Marshal. This is what triggered the start of Ox development.
52
+ It is possible to write an XML serialization gem with Nokogiri or other XML
53
+ parsers but writing such a package in Ruby results in a module significantly
54
+ slower than Marshal. This is what triggered the start of Ox development.
54
55
 
55
56
  Ox handles XML documents in three ways. It is a generic XML parser and writer,
56
57
  a fast Object / XML marshaller, and a stream SAX parser. Ox was written for
@@ -1012,7 +1012,7 @@ dump_obj_to_xml(VALUE obj, Options copts, Out out) {
1012
1012
 
1013
1013
  out->w_time = (Yes == copts->xsd_date) ? dump_time_xsd : dump_time_thin;
1014
1014
  out->buf = (char*)malloc(65336);
1015
- out->end = out->buf + 65336;
1015
+ out->end = out->buf + 65325; // 1 less than end plus extra for possible errors
1016
1016
  out->cur = out->buf;
1017
1017
  out->circ_cache = 0;
1018
1018
  out->circ_cnt = 0;
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '1.4.3'
4
+ VERSION = '1.4.4'
5
5
  end
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby -wW1
2
+
3
+ $: << '../lib'
4
+ $: << '../ext'
5
+
6
+ if __FILE__ == $0
7
+ while (i = ARGV.index('-I'))
8
+ x,path = ARGV.slice!(i, 2)
9
+ $: << path
10
+ end
11
+ end
12
+
13
+ require 'ox'
14
+
15
+ def dump(cnt = 10000)
16
+ h = { }
17
+ cnt.times do |i|
18
+ h[i] = [i * 2, "this is #{i}"]
19
+ end
20
+ xml = Ox.dump(h)
21
+ puts "size: #{xml.size}"
22
+ end
23
+
24
+ dump(200000)
@@ -3,19 +3,21 @@
3
3
  $: << '../lib'
4
4
  $: << '../ext'
5
5
 
6
+ if __FILE__ == $0
7
+ if (i = ARGV.index('-I'))
8
+ x,path = ARGV.slice!(i, 2)
9
+ $: << path
10
+ end
11
+ end
12
+
6
13
  require 'ox'
7
14
 
8
- def name_it()
9
- begin
10
- "x".foo
11
- rescue Exception => e
12
- #puts e.message
13
- xml = Ox.dump(e, effort: :tolerant)
14
- puts xml
15
- o = Ox.load(xml, mode: :object)
16
- puts o.message
17
- puts Ox.dump(e)
15
+ def dump(cnt = 100000)
16
+ cnt.times do |i|
17
+ xml = Ox.dump([:inc, 1])
18
+ #puts xml
19
+
18
20
  end
19
21
  end
20
22
 
21
- name_it()
23
+ dump()
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby -wW1
2
+
3
+ $: << '../lib'
4
+ $: << '../ext'
5
+
6
+ require 'ox'
7
+
8
+ #xml = File.read('bug4.xml')
9
+ xml = File.read('bug4.xml')
10
+
11
+ doc = Ox.parse(xml)
metadata CHANGED
@@ -1,28 +1,28 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ox
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.4
4
5
  prerelease:
5
- version: 1.4.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Peter Ohler
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-12-08 00:00:00 +09:00
14
- default_executable:
12
+ date: 2012-01-13 00:00:00.000000000Z
15
13
  dependencies: []
16
-
17
- description: A fast XML parser and object serializer that uses only standard C lib.
14
+ description: ! "A fast XML parser and object serializer that uses only standard C
15
+ lib.\n \nOptimized XML (Ox), as the name implies was written to provide
16
+ speed optimized\nXML handling. It was designed to be an alternative to Nokogiri
17
+ and other Ruby\nXML parsers for generic XML parsing and as an alternative to Marshal
18
+ for Object\nserialization. "
18
19
  email: peter@ohler.com
19
20
  executables: []
20
-
21
- extensions:
21
+ extensions:
22
22
  - ext/ox/extconf.rb
23
- extra_rdoc_files:
23
+ extra_rdoc_files:
24
24
  - README.md
25
- files:
25
+ files:
26
26
  - lib/ox/bag.rb
27
27
  - lib/ox/cdata.rb
28
28
  - lib/ox/comment.rb
@@ -51,9 +51,11 @@ files:
51
51
  - ext/ox/parse.c
52
52
  - ext/ox/sax.c
53
53
  - test/bench.rb
54
+ - test/big.rb
54
55
  - test/bug1.rb
55
56
  - test/bug2.rb
56
57
  - test/bug3.rb
58
+ - test/bug4.rb
57
59
  - test/cache16_test.rb
58
60
  - test/cache8_test.rb
59
61
  - test/cache_test.rb
@@ -81,41 +83,37 @@ files:
81
83
  - test/perf_sax.rb
82
84
  - test/perf_write.rb
83
85
  - test/sample.rb
84
- - test/sax_example.rb
85
86
  - test/sax_test.rb
86
87
  - test/test.rb
87
88
  - test/Sample.graffle
88
89
  - LICENSE
89
90
  - README.md
90
- has_rdoc: true
91
91
  homepage: https://github.com/ohler55/ox
92
92
  licenses: []
93
-
94
93
  post_install_message:
95
- rdoc_options:
94
+ rdoc_options:
96
95
  - --main
97
96
  - README.md
98
- require_paths:
97
+ require_paths:
99
98
  - lib
100
99
  - ext
101
- required_ruby_version: !ruby/object:Gem::Requirement
100
+ required_ruby_version: !ruby/object:Gem::Requirement
102
101
  none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- version: "0"
107
- required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
107
  none: false
109
- requirements:
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: "0"
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
113
112
  requirements: []
114
-
115
113
  rubyforge_project: ox
116
- rubygems_version: 1.6.2
114
+ rubygems_version: 1.8.10
117
115
  signing_key:
118
116
  specification_version: 3
119
117
  summary: A fast XML parser and object serializer.
120
118
  test_files: []
121
-
119
+ has_rdoc: true
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env ruby -wW1
2
-
3
- $: << '../lib'
4
- $: << '../ext'
5
-
6
- require 'stringio'
7
- require 'ox'
8
-
9
- class Sample < ::Ox::Sax
10
- def start_element(name); puts "start: #{name}"; end
11
- def end_element(name); puts "end: #{name}"; end
12
- def attr(name, value); puts " #{name} => #{value}"; end
13
- def text(value); puts "text #{value}"; end
14
- end
15
-
16
- io = StringIO.new(%{
17
- <top name="sample">
18
- <middle name="second">
19
- <bottom name="third"/>
20
- </middle>
21
- </top>
22
- })
23
-
24
- handler = Sample.new()
25
- Ox.sax_parse(handler, io)
26
-
27
- # outputs
28
- # start: top
29
- # name => sample
30
- # start: middle
31
- # name => second
32
- # start: bottom
33
- # name => third
34
- # end: bottom
35
- # end: middle
36
- # end: top
37
-