ox 2.14.14 → 2.14.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +1 -1
- data/ext/ox/attr.h +33 -39
- data/ext/ox/base64.c +48 -42
- data/ext/ox/base64.h +4 -4
- data/ext/ox/buf.h +80 -86
- data/ext/ox/builder.c +377 -456
- data/ext/ox/cache.c +2 -2
- data/ext/ox/cache8.c +37 -40
- data/ext/ox/cache8.h +7 -7
- data/ext/ox/dump.c +811 -889
- data/ext/ox/err.c +16 -13
- data/ext/ox/err.h +11 -12
- data/ext/ox/extconf.rb +5 -10
- data/ext/ox/gen_load.c +135 -139
- data/ext/ox/hash_load.c +130 -148
- data/ext/ox/helper.h +32 -39
- data/ext/ox/intern.c +1 -2
- data/ext/ox/obj_load.c +586 -662
- data/ext/ox/ox.c +93 -132
- data/ext/ox/ox.h +5 -10
- data/ext/ox/parse.c +836 -874
- data/ext/ox/sax.c +56 -31
- data/ext/ox/sax.h +2 -2
- data/ext/ox/sax_as.c +78 -102
- data/ext/ox/sax_buf.c +85 -94
- data/ext/ox/sax_buf.h +101 -120
- data/ext/ox/sax_hint.c +175 -184
- data/ext/ox/sax_hint.h +19 -19
- data/ext/ox/sax_stack.h +59 -45
- data/ext/ox/slotcache.c +3 -3
- data/ext/ox/slotcache.h +4 -4
- data/ext/ox/special.c +320 -327
- data/ext/ox/special.h +2 -2
- data/ext/ox/type.h +19 -19
- data/lib/ox/bag.rb +13 -9
- data/lib/ox/cdata.rb +0 -2
- data/lib/ox/comment.rb +0 -2
- data/lib/ox/doctype.rb +0 -2
- data/lib/ox/document.rb +3 -5
- data/lib/ox/element.rb +41 -26
- data/lib/ox/error.rb +0 -3
- data/lib/ox/hasattrs.rb +7 -8
- data/lib/ox/instruct.rb +4 -6
- data/lib/ox/node.rb +3 -4
- data/lib/ox/raw.rb +0 -2
- data/lib/ox/sax.rb +20 -36
- data/lib/ox/version.rb +1 -2
- data/lib/ox/xmlrpc_adapter.rb +5 -6
- data/lib/ox.rb +15 -16
- metadata +27 -6
data/lib/ox/xmlrpc_adapter.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
1
|
require 'ox'
|
3
2
|
|
4
3
|
module Ox
|
5
|
-
|
6
4
|
# This is an alternative parser for the stdlib xmlrpc library. It makes
|
7
5
|
# use of Ox and is based on REXMLStreamParser. To use it set is as the
|
8
6
|
# parser for an XMLRPC client:
|
@@ -14,6 +12,7 @@ module Ox
|
|
14
12
|
class StreamParser < XMLRPC::XMLParser::AbstractStreamParser
|
15
13
|
# Create a new instance.
|
16
14
|
def initialize
|
15
|
+
super
|
17
16
|
@parser_class = OxParser
|
18
17
|
end
|
19
18
|
|
@@ -21,13 +20,13 @@ module Ox
|
|
21
20
|
class OxParser < Ox::Sax
|
22
21
|
include XMLRPC::XMLParser::StreamParserMixin
|
23
22
|
|
24
|
-
alias
|
25
|
-
alias
|
26
|
-
alias
|
23
|
+
alias text character
|
24
|
+
alias end_element endElement
|
25
|
+
alias start_element startElement
|
27
26
|
|
28
27
|
# Initiates the sax parser with the provided string.
|
29
28
|
def parse(str)
|
30
|
-
Ox.sax_parse(self, StringIO.new(str), :
|
29
|
+
Ox.sax_parse(self, StringIO.new(str), symbolize: false, convert_special: true)
|
31
30
|
end
|
32
31
|
end
|
33
32
|
end
|
data/lib/ox.rb
CHANGED
@@ -3,63 +3,62 @@
|
|
3
3
|
|
4
4
|
#
|
5
5
|
# === Description:
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# Ox handles XML documents in two ways. It is a generic XML parser and writer as
|
8
8
|
# well as a fast Object / XML marshaller. Ox was written for speed as a
|
9
9
|
# replacement for Nokogiri and for Marshal.
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# As an XML parser it is 2 or more times faster than Nokogiri and as a generic
|
12
12
|
# XML writer it is 14 times faster than Nokogiri. Of course different files may
|
13
13
|
# result in slightly different times.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# As an Object serializer Ox is 4 times faster than the standard Ruby
|
16
16
|
# Marshal.dump(). Ox is 3 times faster than Marshal.load().
|
17
|
-
#
|
17
|
+
#
|
18
18
|
# === Object Dump Sample:
|
19
|
-
#
|
19
|
+
#
|
20
20
|
# require 'ox'
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# class Sample
|
23
23
|
# attr_accessor :a, :b, :c
|
24
|
-
#
|
24
|
+
#
|
25
25
|
# def initialize(a, b, c)
|
26
26
|
# @a = a
|
27
27
|
# @b = b
|
28
28
|
# @c = c
|
29
29
|
# end
|
30
30
|
# end
|
31
|
-
#
|
31
|
+
#
|
32
32
|
# # Create Object
|
33
33
|
# obj = Sample.new(1, "bee", ['x', :y, 7.0])
|
34
34
|
# # Now dump the Object to an XML String.
|
35
35
|
# xml = Ox.dump(obj)
|
36
36
|
# # Convert the object back into a Sample Object.
|
37
37
|
# obj2 = Ox.parse_obj(xml)
|
38
|
-
#
|
38
|
+
#
|
39
39
|
# === Generic XML Writing and Parsing:
|
40
|
-
#
|
40
|
+
#
|
41
41
|
# require 'ox'
|
42
|
-
#
|
42
|
+
#
|
43
43
|
# doc = Ox::Document.new(:version => '1.0')
|
44
|
-
#
|
44
|
+
#
|
45
45
|
# top = Ox::Element.new('top')
|
46
46
|
# top[:name] = 'sample'
|
47
47
|
# doc << top
|
48
|
-
#
|
48
|
+
#
|
49
49
|
# mid = Ox::Element.new('middle')
|
50
50
|
# mid[:name] = 'second'
|
51
51
|
# top << mid
|
52
|
-
#
|
52
|
+
#
|
53
53
|
# bot = Ox::Element.new('bottom')
|
54
54
|
# bot[:name] = 'third'
|
55
55
|
# mid << bot
|
56
|
-
#
|
56
|
+
#
|
57
57
|
# xml = Ox.dump(doc)
|
58
58
|
# puts xml
|
59
59
|
# doc2 = Ox.parse(xml)
|
60
60
|
# puts "Same? #{doc == doc2}"
|
61
61
|
module Ox
|
62
|
-
|
63
62
|
end
|
64
63
|
|
65
64
|
require 'ox/version'
|
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.14.
|
4
|
+
version: 2.14.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
12
|
-
dependencies:
|
11
|
+
date: 2023-07-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake-compiler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
13
33
|
description: "A fast XML parser and object serializer that uses only standard C lib.\n\nOptimized
|
14
34
|
XML (Ox), as the name implies was written to provide speed optimized\nXML handling.
|
15
35
|
It was designed to be an alternative to Nokogiri and other Ruby\nXML parsers for
|
@@ -78,7 +98,8 @@ files:
|
|
78
98
|
homepage: http://www.ohler.com/ox
|
79
99
|
licenses:
|
80
100
|
- MIT
|
81
|
-
metadata:
|
101
|
+
metadata:
|
102
|
+
rubygems_mfa_required: 'true'
|
82
103
|
post_install_message:
|
83
104
|
rdoc_options:
|
84
105
|
- "--main"
|
@@ -97,14 +118,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
118
|
requirements:
|
98
119
|
- - ">="
|
99
120
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
121
|
+
version: 2.7.0
|
101
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
123
|
requirements:
|
103
124
|
- - ">="
|
104
125
|
- !ruby/object:Gem::Version
|
105
126
|
version: '0'
|
106
127
|
requirements: []
|
107
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.4.1
|
108
129
|
signing_key:
|
109
130
|
specification_version: 4
|
110
131
|
summary: A fast XML parser and object serializer.
|