ox 2.1.8 → 2.2.0
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.
- checksums.yaml +4 -4
- data/README.md +10 -2
- data/ext/ox/ox.c +12 -4
- data/ext/ox/ox.h +2 -0
- data/lib/ox.rb +0 -25
- data/lib/ox/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a72bd41c796380d832d6fe08b7b7e77aeca0bbe4
|
4
|
+
data.tar.gz: 5aa7c7ef218a7a97cda25bd1586e133f168e91af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 715a10def5ec9ab769de09a7ac0ed6e7cbd56b48cb75a8e5f347a3143cfb3128df8224bf2a7b3d7d598fd297ef294f3120a5de3ad153e4a175d970005bb5f9a6
|
7
|
+
data.tar.gz: d6edb43235036f091a8150b998a5ce4115c19317203cc853d60f3e34f77b3971896c4bd87fae16b74ce9e3ce6f950664eec7fb42232bd88c12329e93f887bbc0
|
data/README.md
CHANGED
@@ -30,11 +30,19 @@ A fast XML parser and Object marshaller as a Ruby gem.
|
|
30
30
|
|
31
31
|
*Fast JSON parser and marshaller on RubyGems*: https://rubygems.org/gems/oj
|
32
32
|
|
33
|
-
*Fast JSON parser and marshaller on GitHub*: https://
|
33
|
+
*Fast JSON parser and marshaller on GitHub*: https://github.com/ohler55/oj
|
34
34
|
|
35
35
|
## Release Notes
|
36
36
|
|
37
|
-
### Current Release 2.
|
37
|
+
### Current Release 2.2.0
|
38
|
+
|
39
|
+
- Added the SAX convert_special option to the default options.
|
40
|
+
|
41
|
+
- Added the SAX smart option to the default options.
|
42
|
+
|
43
|
+
- Other SAX options are now taken from the defaults if not specified.
|
44
|
+
|
45
|
+
### Release 2.1.8
|
38
46
|
|
39
47
|
- Fixed a bug that caused all input to be read before parsing with the sax
|
40
48
|
parser and an IO.pipe.
|
data/ext/ox/ox.c
CHANGED
@@ -145,6 +145,8 @@ struct _Options ox_default_options = {
|
|
145
145
|
StrictEffort, /* effort */
|
146
146
|
Yes, /* sym_keys */
|
147
147
|
NoSkip, /* skip */
|
148
|
+
No, /* smart */
|
149
|
+
No, /* convert_special */
|
148
150
|
#if HAS_PRIVATE_ENCODING
|
149
151
|
Qnil /* rb_enc */
|
150
152
|
#else
|
@@ -223,6 +225,8 @@ defuse_bom(char *xml, Options options) {
|
|
223
225
|
* - effort: [:strict|:tolerant|:auto_define] set the tolerance level for loading
|
224
226
|
* - symbolize_keys: [true|false|nil] symbolize element attribute keys or leave as Strings
|
225
227
|
* - skip: [:skip_none|:skip_return|:skip_white] determines how to handle white space in text
|
228
|
+
* - smart: [true|false|nil] flag indicating the SAX parser uses hints if available (use with html)
|
229
|
+
* - convert_special: [true|false|nil] flag indicating special characters like < are converted with the SAX parser
|
226
230
|
* @return [Hash] all current option settings.
|
227
231
|
*
|
228
232
|
* Note that an indent of less than zero will result in a tight one line output
|
@@ -242,6 +246,8 @@ get_def_opts(VALUE self) {
|
|
242
246
|
rb_hash_aset(opts, circular_sym, (Yes == ox_default_options.circular) ? Qtrue : ((No == ox_default_options.circular) ? Qfalse : Qnil));
|
243
247
|
rb_hash_aset(opts, xsd_date_sym, (Yes == ox_default_options.xsd_date) ? Qtrue : ((No == ox_default_options.xsd_date) ? Qfalse : Qnil));
|
244
248
|
rb_hash_aset(opts, symbolize_keys_sym, (Yes == ox_default_options.sym_keys) ? Qtrue : ((No == ox_default_options.sym_keys) ? Qfalse : Qnil));
|
249
|
+
rb_hash_aset(opts, smart_sym, (Yes == ox_default_options.smart) ? Qtrue : ((No == ox_default_options.smart) ? Qfalse : Qnil));
|
250
|
+
rb_hash_aset(opts, convert_special_sym, (Yes == ox_default_options.convert_special) ? Qtrue : ((No == ox_default_options.convert_special) ? Qfalse : Qnil));
|
245
251
|
switch (ox_default_options.mode) {
|
246
252
|
case ObjMode: rb_hash_aset(opts, mode_sym, object_sym); break;
|
247
253
|
case GenMode: rb_hash_aset(opts, mode_sym, generic_sym); break;
|
@@ -292,6 +298,8 @@ set_def_opts(VALUE self, VALUE opts) {
|
|
292
298
|
{ xsd_date_sym, &ox_default_options.xsd_date },
|
293
299
|
{ circular_sym, &ox_default_options.circular },
|
294
300
|
{ symbolize_keys_sym, &ox_default_options.sym_keys },
|
301
|
+
{ smart_sym, &ox_default_options.smart },
|
302
|
+
{ convert_special_sym, &ox_default_options.convert_special },
|
295
303
|
{ Qnil, 0 }
|
296
304
|
};
|
297
305
|
YesNoOpt o;
|
@@ -695,10 +703,10 @@ static VALUE
|
|
695
703
|
sax_parse(int argc, VALUE *argv, VALUE self) {
|
696
704
|
struct _SaxOptions options;
|
697
705
|
|
698
|
-
options.symbolize =
|
699
|
-
options.convert_special =
|
700
|
-
options.smart =
|
701
|
-
options.skip =
|
706
|
+
options.symbolize = (No != ox_default_options.sym_keys);
|
707
|
+
options.convert_special = (Yes == ox_default_options.convert_special);
|
708
|
+
options.smart = (Yes == ox_default_options.smart);
|
709
|
+
options.skip = ox_default_options.skip;
|
702
710
|
|
703
711
|
if (argc < 2) {
|
704
712
|
rb_raise(ox_parse_error_class, "Wrong number of arguments to sax_parse.\n");
|
data/ext/ox/ox.h
CHANGED
@@ -131,6 +131,8 @@ typedef struct _Options {
|
|
131
131
|
char effort; /* Effort */
|
132
132
|
char sym_keys; /* symbolize keys */
|
133
133
|
char skip; /* skip mode */
|
134
|
+
char smart; /* YesNo sax smart mode */
|
135
|
+
char convert_special;/* YesNo sax smart mode */
|
134
136
|
#if HAS_ENCODING_SUPPORT
|
135
137
|
rb_encoding *rb_enc;
|
136
138
|
#elif HAS_PRIVATE_ENCODING
|
data/lib/ox.rb
CHANGED
@@ -1,30 +1,5 @@
|
|
1
1
|
# Copyright (c) 2011, Peter Ohler<br>
|
2
2
|
# All rights reserved.
|
3
|
-
#
|
4
|
-
# Redistribution and use in source and binary forms, with or without
|
5
|
-
# modification, are permitted provided that the following conditions are met:
|
6
|
-
#
|
7
|
-
# - Redistributions of source code must retain the above copyright notice, this
|
8
|
-
# list of conditions and the following disclaimer.
|
9
|
-
#
|
10
|
-
# - Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
# this list of conditions and the following disclaimer in the documentation
|
12
|
-
# and/or other materials provided with the distribution.
|
13
|
-
#
|
14
|
-
# - Neither the name of Peter Ohler nor the names of its contributors may be
|
15
|
-
# used to endorse or promote products derived from this software without
|
16
|
-
# specific prior written permission.
|
17
|
-
#
|
18
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
22
|
-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
24
|
-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
25
|
-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
26
|
-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
27
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
3
|
|
29
4
|
# === Description:
|
30
5
|
#
|
data/lib/ox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: "A fast XML parser and object serializer that uses only standard C lib.\n
|
14
14
|
\ \nOptimized XML (Ox), as the name implies was written to provide speed
|
@@ -97,4 +97,3 @@ signing_key:
|
|
97
97
|
specification_version: 4
|
98
98
|
summary: A fast XML parser and object serializer.
|
99
99
|
test_files: []
|
100
|
-
has_rdoc: true
|