ox 1.5.0 → 1.5.1
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 +2 -4
- data/ext/ox/dump.c +1 -1
- data/lib/ox/version.rb +1 -1
- metadata +2 -5
- data/test/bug3.rb +0 -21
- data/test/bug4.rb +0 -60
- data/test/sax_example.rb +0 -37
data/README.md
CHANGED
@@ -30,11 +30,9 @@ A fast XML parser and Object marshaller as a Ruby gem.
|
|
30
30
|
|
31
31
|
## <a name="release">Release Notes</a>
|
32
32
|
|
33
|
-
### Release 1.5.
|
33
|
+
### Release 1.5.1
|
34
34
|
|
35
|
-
-
|
36
|
-
|
37
|
-
- Prefixed extern C functions with ox_ to avoid conflicts.
|
35
|
+
- Fixed XML dump character table. the '?' character was marked incorrectly.
|
38
36
|
|
39
37
|
## <a name="description">Description</a>
|
40
38
|
|
data/ext/ox/dump.c
CHANGED
@@ -110,7 +110,7 @@ static char xml_friendly_chars[256] = "\
|
|
110
110
|
88888888811881888888888888888888\
|
111
111
|
11611156111111111111111111114141\
|
112
112
|
11111111111111111111111111111111\
|
113
|
-
|
113
|
+
11111111111111111111111111111111\
|
114
114
|
11111111111111111111111111111111\
|
115
115
|
11111111111111111111111111111111\
|
116
116
|
11111111111111111111111111111111\
|
data/lib/ox/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! "A fast XML parser and object serializer that uses only standard C
|
15
15
|
lib.\n \nOptimized XML (Ox), as the name implies was written to provide
|
@@ -53,8 +53,6 @@ files:
|
|
53
53
|
- test/bench.rb
|
54
54
|
- test/bug1.rb
|
55
55
|
- test/bug2.rb
|
56
|
-
- test/bug3.rb
|
57
|
-
- test/bug4.rb
|
58
56
|
- test/cache16_test.rb
|
59
57
|
- test/cache8_test.rb
|
60
58
|
- test/cache_test.rb
|
@@ -95,7 +93,6 @@ files:
|
|
95
93
|
- test/sample/shape.rb
|
96
94
|
- test/sample/text.rb
|
97
95
|
- test/sample.rb
|
98
|
-
- test/sax_example.rb
|
99
96
|
- test/sax_test.rb
|
100
97
|
- test/test.rb
|
101
98
|
- test/Sample.graffle
|
data/test/bug3.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby -wW1
|
2
|
-
|
3
|
-
$: << '../lib'
|
4
|
-
$: << '../ext'
|
5
|
-
|
6
|
-
require 'ox'
|
7
|
-
|
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)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
name_it()
|
data/test/bug4.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby -wW1
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
$: << File.join(File.dirname(__FILE__), "../lib")
|
5
|
-
$: << File.join(File.dirname(__FILE__), "../ext")
|
6
|
-
|
7
|
-
require 'stringio'
|
8
|
-
require 'ox'
|
9
|
-
|
10
|
-
x1 = %(<?xml version="1.0" encoding="ISO-8859-1" ?><tag key="value">Français</tag>).encode("ISO-8859-1")
|
11
|
-
# => "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?><tag key=\"value\">Fran\xE7ais</tag>"
|
12
|
-
x1.encoding
|
13
|
-
# => #<Encoding:ISO-8859-1>
|
14
|
-
|
15
|
-
x2 = %(<?xml version="1.0" encoding="UTF-8" ?><tag key="value">Français</tag>)
|
16
|
-
# => "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><tag key=\"value\">Fran\xC3\xA7ais</tag>"
|
17
|
-
x2.encoding
|
18
|
-
# => #<Encoding:UTF-8>
|
19
|
-
|
20
|
-
class OH < ::Ox::Sax
|
21
|
-
def start_element(name)
|
22
|
-
puts "EL: #{name} (#{name.encoding})"
|
23
|
-
end
|
24
|
-
|
25
|
-
def end_element(name)
|
26
|
-
end
|
27
|
-
|
28
|
-
def attr(key, value)
|
29
|
-
puts "AT: #{key} => #{value} (#{key.encoding} => #{value.encoding})"
|
30
|
-
end
|
31
|
-
|
32
|
-
def text(value)
|
33
|
-
puts "TX: #{value} (#{value.encoding})"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
::Ox.sax_parse OH.new, StringIO.new(x1)
|
38
|
-
# => AT: version => 1.0 (US-ASCII => ASCII-8BIT)
|
39
|
-
# AT: encoding => ISO-8859-1 (US-ASCII => ISO-8859-1)
|
40
|
-
# EL: tag (US-ASCII)
|
41
|
-
# AT: key => value (US-ASCII => ISO-8859-1)
|
42
|
-
# TX: Fran�ais (ISO-8859-1)
|
43
|
-
|
44
|
-
puts
|
45
|
-
|
46
|
-
::Ox.sax_parse OH.new, StringIO.new(x2)
|
47
|
-
# => AT: version => 1.0 (US-ASCII => ASCII-8BIT)
|
48
|
-
# AT: encoding => UTF-8 (US-ASCII => UTF-8)
|
49
|
-
# EL: tag (US-ASCII)
|
50
|
-
# AT: key => value (US-ASCII => UTF-8)
|
51
|
-
# TX: Français (UTF-8)
|
52
|
-
|
53
|
-
puts
|
54
|
-
x3 = %(<?xml version="1.0" encoding="ISO-8859-1" ?><tag Português="Español">Français</tag>).encode("ISO-8859-1")
|
55
|
-
::Ox.sax_parse OH.new, StringIO.new(x3)
|
56
|
-
|
57
|
-
puts
|
58
|
-
x4 = %(<?xml version="1.0" encoding="UTF-8" ?><tag Português="Español">Français</tag>)
|
59
|
-
::Ox.sax_parse OH.new, StringIO.new(x4)
|
60
|
-
|
data/test/sax_example.rb
DELETED
@@ -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
|
-
|