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 +5 -5
- data/CHANGELOG.md +5 -1
- data/README.md +22 -5
- data/ext/ox/dump.c +1 -1
- data/ext/ox/sax_buf.h +1 -1
- data/lib/ox/version.rb +1 -1
- metadata +3 -4
- data/ext/ox/encode.h +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2bf1d16f91469616bdbecb3d9b5a63cae12d2b92bf7abcafac9159f3525f464e
|
4
|
+
data.tar.gz: 810e9202e1e726115b204145e00afe33f83870ddf6a72ec1f01cc0b62af7203d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42526f5a26342762291351438ca9372f931b831aa99c304e963cce2fd81d4a5fe3d03a09277b7d1de2f479f719ebff456c105fd708391eddeea35969965ad060
|
7
|
+
data.tar.gz: dfafe308bc9b25fa8005e56600ccdb630da0b008137baa2bc7efd0ada62a122a3acd386ac7587e95a624151ed933d19d508a59d8af1cfbb88e161357d5c9125f
|
data/CHANGELOG.md
CHANGED
@@ -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
|
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
|
+
[](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
|
-
[](http://travis-ci.org/ohler55/ox)
|
24
|
-
|
25
|
-
## Donate
|
26
|
-
|
27
|
-
[](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
|
data/ext/ox/dump.c
CHANGED
@@ -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
|
-
|
95
|
+
11611151111111111111111111114141\
|
96
96
|
11111111111111111111111111111111\
|
97
97
|
11111111111111111111111111111111\
|
98
98
|
11111111111111111111111111111111\
|
data/ext/ox/sax_buf.h
CHANGED
@@ -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
|
-
|
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';
|
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.8.
|
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:
|
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.
|
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.
|
data/ext/ox/encode.h
DELETED
@@ -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__ */
|