ox 2.8.2 → 2.8.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 066b29e775aa1fbf8beb40e572299a3b99155c92
4
- data.tar.gz: 41c0e36f4f7bbebcef8f27c7e75d80c3c6420423
2
+ SHA256:
3
+ metadata.gz: 2bf1d16f91469616bdbecb3d9b5a63cae12d2b92bf7abcafac9159f3525f464e
4
+ data.tar.gz: 810e9202e1e726115b204145e00afe33f83870ddf6a72ec1f01cc0b62af7203d
5
5
  SHA512:
6
- metadata.gz: fbdf712b54810a1bff6c211d0f4b7e63ee8a1ed48911b4d43491c3792acd44c3f32bdc6da7028f8de87dfcc937162bb8116e13c9d73c1a60998a7eafb71efa24
7
- data.tar.gz: f7378812079495da8752277b52c7372e739b848e24cf1845eb6e1d48e625d560c93374373d7d429b2612111b2173a9ce180a32385734e3b2f8e073f0937b143a
6
+ metadata.gz: 42526f5a26342762291351438ca9372f931b831aa99c304e963cce2fd81d4a5fe3d03a09277b7d1de2f479f719ebff456c105fd708391eddeea35969965ad060
7
+ data.tar.gz: dfafe308bc9b25fa8005e56600ccdb630da0b008137baa2bc7efd0ada62a122a3acd386ac7587e95a624151ed933d19d508a59d8af1cfbb88e161357d5c9125f
@@ -1,4 +1,8 @@
1
1
 
2
+ ## 2.8.3 - March 3, 2018
3
+
4
+ - Attribute values now escape < and > on dump.
5
+
2
6
  ## 2.8.2 - November 1, 2017
3
7
 
4
8
  - Fixed bug with SAX parser that caused a crash with very long invalid instruction element.
@@ -7,7 +11,7 @@
7
11
 
8
12
  ## 2.8.1 - October 27, 2017
9
13
 
10
- - Avoid crash with invalid XML passed to Oj.parse_obj().
14
+ - Avoid crash with invalid XML passed to Ox.parse_obj().
11
15
 
12
16
  ## 2.8.0 - September 22, 2017
13
17
 
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Ox gem
2
2
  A fast XML parser and Object marshaller as a Ruby gem.
3
3
 
4
+ [![Build Status](https://secure.travis-ci.org/ohler55/ox.png?branch=master)](http://travis-ci.org/ohler55/ox)
5
+
4
6
  ## Installation
5
7
  gem install ox
6
8
 
@@ -20,11 +22,6 @@ A fast XML parser and Object marshaller as a Ruby gem.
20
22
 
21
23
  ## Build Status
22
24
 
23
- [![Build Status](https://secure.travis-ci.org/ohler55/ox.png?branch=master)](http://travis-ci.org/ohler55/ox)
24
-
25
- ## Donate
26
-
27
- [![Gratipay](https://img.shields.io/gratipay/project/ox.svg)](https://gratipay.com/ox/)
28
25
 
29
26
  ## Links of Interest
30
27
 
@@ -218,6 +215,26 @@ puts "after parse"
218
215
  # after parse
219
216
  ```
220
217
 
218
+ ### Parsing XML into a Hash (fast)
219
+
220
+ ```ruby
221
+ require 'ox'
222
+
223
+ xml = %{
224
+ <top name="sample">
225
+ <middle name="second">
226
+ <bottom name="third">Rock bottom</bottom>
227
+ </middle>
228
+ </top>
229
+ }
230
+
231
+ puts Ox.load(xml, mode: :hash)
232
+ puts Ox.load(xml, mode: :hash_no_attrs)
233
+
234
+ #{:top=>[{:name=>"sample"}, {:middle=>[{:name=>"second"}, {:bottom=>[{:name=>"third"}, "Rock bottom"]}]}]}
235
+ #{:top=>{:middle=>{:bottom=>"Rock bottom"}}}
236
+ ```
237
+
221
238
  ### Object XML format
222
239
 
223
240
  The XML format used for Object encoding follows the structure of the
@@ -92,7 +92,7 @@ static const char xml_friendly_chars[257] = "\
92
92
 
93
93
  static const char xml_quote_chars[257] = "\
94
94
  :::::::::11::1::::::::::::::::::\
95
- 11611151111111111111111111111111\
95
+ 11611151111111111111111111114141\
96
96
  11111111111111111111111111111111\
97
97
  11111111111111111111111111111111\
98
98
  11111111111111111111111111111111\
@@ -44,7 +44,7 @@ extern int ox_sax_buf_read(Buf buf);
44
44
 
45
45
  static inline char
46
46
  buf_get(Buf buf) {
47
- //printf("*** drive get from '%s' from start: %ld buf: %p from read_end: %ld\n", buf->tail, buf->tail - buf->head, buf->head, buf->read_end - buf->tail);
47
+ printf("*** drive get from '%s' from start: %ld buf: %p from read_end: %ld\n", buf->tail, buf->tail - buf->head, buf->head, buf->read_end - buf->tail);
48
48
  if (buf->read_end <= buf->tail) {
49
49
  if (0 != ox_sax_buf_read(buf)) {
50
50
  return '\0';
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '2.8.2'
4
+ VERSION = '2.8.3'
5
5
  end
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.8.2
4
+ version: 2.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-01 00:00:00.000000000 Z
11
+ date: 2018-03-03 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
@@ -35,7 +35,6 @@ files:
35
35
  - ext/ox/cache8.c
36
36
  - ext/ox/cache8.h
37
37
  - ext/ox/dump.c
38
- - ext/ox/encode.h
39
38
  - ext/ox/err.c
40
39
  - ext/ox/err.h
41
40
  - ext/ox/extconf.rb
@@ -100,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
99
  version: '0'
101
100
  requirements: []
102
101
  rubyforge_project: ox
103
- rubygems_version: 2.6.11
102
+ rubygems_version: 2.7.3
104
103
  signing_key:
105
104
  specification_version: 4
106
105
  summary: A fast XML parser and object serializer.
@@ -1,26 +0,0 @@
1
- /* encode.h
2
- * Copyright (c) 2011, Peter Ohler
3
- * All rights reserved.
4
- */
5
-
6
- #ifndef __OX_ENCODE_H__
7
- #define __OX_ENCODE_H__
8
-
9
- #include "ruby.h"
10
- #if HAS_ENCODING_SUPPORT
11
- #include "ruby/encoding.h"
12
- #endif
13
-
14
- static inline VALUE
15
- ox_encode(VALUE rstr) {
16
- #if HAS_ENCODING_SUPPORT
17
- rb_enc_associate(rstr, ox_utf8_encoding);
18
- #else
19
- if (Qnil != ox_utf8_encoding) {
20
- rstr = rb_funcall(ox_utf8_encoding, ox_iconv_id, 1, rstr);
21
- }
22
- #endif
23
- return rstr;
24
- }
25
-
26
- #endif /* __OX_ENCODE_H__ */