ox 2.10.1 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +243 -162
- data/ext/ox/builder.c +1 -1
- data/ext/ox/dump.c +1 -1
- data/ext/ox/err.h +1 -0
- data/ext/ox/gen_load.c +4 -4
- data/ext/ox/ox.c +4 -2
- data/ext/ox/sax_buf.c +3 -4
- data/ext/ox/sax_buf.h +12 -10
- data/lib/ox/error.rb +4 -0
- data/lib/ox/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 837c0ef02149244d49ab2779216dbafc40c46cf1af3354d6ef35779929176476
|
4
|
+
data.tar.gz: b749a74dee9e1ff268cf69ca6dfff6edcb5681e2c4abe90a07a10442689cc484
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f18d97d2e7c3087a07983f32b4d1e061e46866e5d17734689e8af68c8c004b669c008cb7321246123b060d44099624e2c039065727886ba146a412a7f8cae166
|
7
|
+
data.tar.gz: 90f9b3fcc779a2ac25e7a317a3fa17f028c4f9008bb8e57c6dc26693965add3cb116f7e9b250d64038f9928d027ee178f7e633320152202f94a1d896edff6f63
|
data/CHANGELOG.md
CHANGED
@@ -1,306 +1,361 @@
|
|
1
|
+
# Changelog
|
1
2
|
|
2
|
-
|
3
|
+
All changes to the Ox gem are documented here. Releases follow semantic versioning.
|
3
4
|
|
4
|
-
|
5
|
+
## [Unreleased]
|
5
6
|
|
6
|
-
## 2.
|
7
|
+
## [2.11.0] - 2019-06-14
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
### Changed
|
10
|
+
- Ox::SyntaxError replaces SyntaxError where such an exception would have previously been raised.
|
10
11
|
|
11
|
-
|
12
|
+
### Fixed
|
13
|
+
- File offsets when using the SAX parser now use `off_t`. Setting
|
14
|
+
`-D_FILE_OFFSET_BITS=64` in the Makefile may allow 32 bit systems to access
|
15
|
+
files larger than 2^32 in size. This has not been tested.
|
12
16
|
|
13
|
-
|
17
|
+
## [2.10.1] - 2019-05-27
|
14
18
|
|
15
|
-
|
19
|
+
### Fixed
|
20
|
+
- Remove extra space from doctype dump.
|
16
21
|
|
17
|
-
|
22
|
+
## [2.10.0] - 2018-08-26
|
18
23
|
|
19
|
-
|
24
|
+
### Fixed
|
25
|
+
- `:element_key_mod` and `:attr_key_mod` options were added to allow keys to be modified when loading.
|
20
26
|
|
21
|
-
## 2.9.
|
27
|
+
## [2.9.4] - 2018-07-16
|
22
28
|
|
23
|
-
|
29
|
+
### Fixed
|
30
|
+
- Fixed issue with malformed object mode input.
|
24
31
|
|
25
|
-
|
32
|
+
## [2.9.3] - 2018-06-12
|
26
33
|
|
27
|
-
|
34
|
+
### Fixed
|
35
|
+
- Handle `\0` in dumped strings better.
|
36
|
+
- No `\n` added on dumped if indent is less than zero.
|
28
37
|
|
29
|
-
|
38
|
+
## [2.9.2] - 2018-04-16
|
30
39
|
|
31
|
-
|
40
|
+
### Fixed
|
41
|
+
- `locate` fixed to cover a missing condition with named child thanks to mberlanda.
|
32
42
|
|
33
|
-
|
43
|
+
### Added
|
44
|
+
- `locate` supports attribute exists searches thanks to mberlanda.
|
34
45
|
|
35
|
-
|
46
|
+
## [2.9.1] - 2018-04-14
|
36
47
|
|
37
|
-
|
48
|
+
### Fixed
|
49
|
+
- `prepend_child` added by mberlanda.
|
38
50
|
|
39
|
-
|
51
|
+
## [2.9.0] - 2018-03-13
|
40
52
|
|
41
|
-
|
53
|
+
### Added
|
54
|
+
- New builder methods for building HTML.
|
55
|
+
- Examples added.
|
42
56
|
|
43
|
-
|
57
|
+
## [2.8.4] - 2018-03-4
|
44
58
|
|
45
|
-
|
59
|
+
### Fixed
|
60
|
+
- Commented out debug statement.
|
46
61
|
|
47
|
-
|
62
|
+
## [2.8.3] - 2018-03-3
|
48
63
|
|
49
|
-
|
64
|
+
### Fixed
|
65
|
+
- Attribute values now escape < and > on dump.
|
50
66
|
|
51
|
-
## 2.8.
|
67
|
+
## [2.8.2] - 2017-11-1
|
52
68
|
|
53
|
-
|
69
|
+
### Fixed
|
70
|
+
- Fixed bug with SAX parser that caused a crash with very long invalid instruction element.
|
71
|
+
- Fixed SAX parse error with double <source> elements.
|
54
72
|
|
55
|
-
## 2.8.
|
73
|
+
## [2.8.1] - 2017-10-27
|
56
74
|
|
57
|
-
|
58
|
-
|
75
|
+
### Fixed
|
76
|
+
- Avoid crash with invalid XML passed to Ox.parse_obj().
|
59
77
|
|
60
|
-
## 2.
|
78
|
+
## [2.8.0] - 2017-09-22
|
61
79
|
|
62
|
-
|
63
|
-
|
80
|
+
### Fixed
|
81
|
+
- Added :skip_off mode to make sax callback on every none empty string even if there are not other non-whitespace characters present.
|
64
82
|
|
65
|
-
|
83
|
+
## [2.7.0] - 2017-08-18
|
66
84
|
|
67
|
-
|
85
|
+
### Added
|
86
|
+
- Two new load modes added, :hash and :hash_no_attrs. Both load an XML document to create a Hash populated with core Ruby objects.
|
68
87
|
|
69
|
-
|
88
|
+
### Fixed
|
89
|
+
- Worked around Ruby API change for RSTRUCT_LEN so Ruby 2.4.2 does not crash.
|
70
90
|
|
71
|
-
|
91
|
+
## [2.6.0] - 2017-08-9
|
72
92
|
|
73
|
-
|
93
|
+
### Added
|
94
|
+
- The Element#each() method was added to allow iteration over Element nodes conditionally.
|
95
|
+
- Element#locate() now supports a [@attr=value] specification.
|
96
|
+
- An underscore character used in the easy API is now treated as a wild card for valid XML characters that are not valid for Ruby method names.
|
74
97
|
|
75
|
-
## 2.5.0 -
|
98
|
+
## [2.5.0] - 2017-05-4
|
76
99
|
|
77
|
-
|
100
|
+
### Added
|
101
|
+
- Added a :nest_ok option to SAX hints that will ignore the nested check on a tag to accomadate non-compliant HTML.
|
78
102
|
|
79
|
-
|
80
|
-
|
103
|
+
### Changed
|
104
|
+
- Set the default for skip to be to skip white space.
|
81
105
|
|
82
|
-
## 2.4.13 -
|
106
|
+
## [2.4.13] - 2017-04-21
|
83
107
|
|
84
|
-
|
108
|
+
### Fixed
|
109
|
+
- Corrected Builder special character handling.
|
85
110
|
|
86
|
-
## 2.4.12 -
|
111
|
+
## [2.4.12] - 2017-04-11
|
87
112
|
|
88
|
-
|
113
|
+
### Fixed
|
114
|
+
- Fixed position in builder when encoding special characters.
|
89
115
|
|
90
|
-
## 2.4.11 -
|
116
|
+
## [2.4.11] - 2017-03-19
|
91
117
|
|
92
|
-
|
118
|
+
### Fixed
|
119
|
+
- Fixed SAX parser bug regarding upper case hints not matching.
|
93
120
|
|
94
|
-
## 2.4.10 -
|
121
|
+
## [2.4.10] - 2017-02-13
|
95
122
|
|
96
|
-
|
123
|
+
### Fixed
|
124
|
+
- Dump is now smarter about which characters to replace with &xxx; alternatives.
|
97
125
|
|
98
|
-
## 2.4.9 -
|
126
|
+
## [2.4.9] - 2017-01-25
|
99
127
|
|
100
|
-
|
128
|
+
### Added
|
129
|
+
- Added a SAX hint that allows comments to be treated like other elements.
|
101
130
|
|
102
|
-
## 2.4.8 -
|
131
|
+
## [2.4.8] - 2017-01-15
|
103
132
|
|
104
|
-
|
105
|
-
|
133
|
+
### Changed
|
134
|
+
- Tolerant mode now allows case-insensitve matches on elements during parsing. Smart mode in the SAX parser is also case insensitive.
|
106
135
|
|
107
|
-
## 2.4.7 - December
|
136
|
+
## [2.4.7] - 2016-December-25
|
108
137
|
|
109
|
-
|
138
|
+
### Fixed
|
139
|
+
- After encountering a <> the SAX parser will continue parsing after reporting an error.
|
110
140
|
|
111
|
-
## 2.4.6 -
|
141
|
+
## [2.4.6] - 2016-11-28
|
112
142
|
|
113
|
-
|
143
|
+
### Added
|
144
|
+
- Added margin option to dump.
|
114
145
|
|
115
|
-
## 2.4.5 -
|
146
|
+
## [2.4.5] - 2016-09-11
|
116
147
|
|
117
|
-
|
148
|
+
### Fixed
|
149
|
+
- Thanks to GUI for fixing an infinite loop in Ox::Builder.
|
118
150
|
|
119
|
-
## 2.4.4 -
|
151
|
+
## [2.4.4] - 2016-08-9
|
120
152
|
|
121
|
-
|
153
|
+
### Fixed
|
154
|
+
- Builder element attributes with special characters are now encoded correctly.
|
155
|
+
- A newline at end of an XML string is now controlled by the indent value. A value of-1 indicates no terminating newline character and an indentation of zero.
|
122
156
|
|
123
|
-
-
|
124
|
-
value of -1 indicates no terminating newline character and an indentation of
|
125
|
-
zero.
|
157
|
+
## [2.4.3] - 2016-06-26
|
126
158
|
|
127
|
-
|
159
|
+
### Fixed
|
160
|
+
- Fixed compiler warnings and errors.
|
161
|
+
- Updated for Ruby 2.4.0.
|
128
162
|
|
129
|
-
-
|
163
|
+
## [2.4.2] - 2016-06-23
|
130
164
|
|
131
|
-
|
165
|
+
### Fixed
|
166
|
+
- Added methods to Ox::Builder to provide output position information.
|
132
167
|
|
133
|
-
## 2.4.
|
168
|
+
## [2.4.1] - 2016-04-30
|
134
169
|
|
135
|
-
|
170
|
+
### Added
|
171
|
+
- Added overlay feature to give control over which elements generate callbacks with the SAX parser.
|
172
|
+
- Element.locate now includes self if the path is relative and starts with a wildcard.
|
136
173
|
|
137
|
-
|
174
|
+
### Fixed
|
175
|
+
- Made SAX smarter a little smarter or rather let it handle unquoted string with a / at the end.
|
176
|
+
- Fixed bug with reporting errors of element names that are too long.
|
138
177
|
|
139
|
-
-
|
140
|
-
with a / at the end.
|
178
|
+
## [2.4.0] - 2016-04-14
|
141
179
|
|
142
|
-
|
180
|
+
### Fixed
|
181
|
+
- Added Ox::Builder that constructs an XML string or writes XML to a stream using builder methods.
|
143
182
|
|
144
|
-
-
|
145
|
-
with the SAX parser.
|
183
|
+
## [2.3.0] - 2016-02-21
|
146
184
|
|
147
|
-
|
185
|
+
### Added
|
186
|
+
- Added Ox::Element.replace_text() method.
|
187
|
+
- A invalid_replace option has been added. It will replace invalid XML
|
188
|
+
character with a provided string. Strict effort now raises an exception if
|
189
|
+
an invalid character is encountered on dump or load.
|
148
190
|
|
149
|
-
|
191
|
+
### Changed
|
192
|
+
- Ox.load and Ox.parse now allow for a callback block to handle multiple top
|
193
|
+
level entities in the input.
|
194
|
+
- The Ox SAX parser now supports strings as input directly without and IO wrapper.
|
150
195
|
|
151
|
-
|
152
|
-
|
196
|
+
### Fixed
|
197
|
+
- Ox::Element nodes variable is now always initialized to an empty Array.
|
198
|
+
- Ox::Element attributes variable is now always initialized to an empty Hash.
|
153
199
|
|
154
|
-
## 2.
|
200
|
+
## [2.2.4] - 2016-02-4
|
155
201
|
|
156
|
-
|
202
|
+
### Fixed
|
203
|
+
- Changed the code to allow compilation on older compilers. No change in
|
204
|
+
functionality otherwise.
|
157
205
|
|
158
|
-
-
|
206
|
+
## [2.2.3] - 2015-December-31
|
159
207
|
|
160
|
-
|
208
|
+
### Fixed
|
209
|
+
- The convert_special option now applies to attributes as well as elements in
|
210
|
+
the SAX parser.
|
161
211
|
|
162
|
-
|
163
|
-
|
164
|
-
invalid character is encountered on dump or load.
|
212
|
+
- The convert_special option now applies to the regualr parser as well as the
|
213
|
+
SAX parser.
|
165
214
|
|
166
|
-
|
167
|
-
level entities in the input.
|
215
|
+
- Updated to work correctly with Ruby 2.3.0.
|
168
216
|
|
169
|
-
-
|
217
|
+
## [2.2.2] - 2015-10-19
|
170
218
|
|
171
|
-
|
219
|
+
### Fixed
|
220
|
+
- Fixed problem with detecting invalid special character sequences.
|
172
221
|
|
173
|
-
|
174
|
-
functionality otherwise.
|
222
|
+
- Fixed bug that caused a crash when an <> was encountered with the SAX parser.
|
175
223
|
|
176
|
-
## 2.2.
|
177
|
-
|
178
|
-
- The convert_special option now applies to attributes as well as elements in
|
179
|
-
the SAX parser.
|
180
|
-
|
181
|
-
- The convert_special option now applies to the regualr parser as well as the
|
182
|
-
SAX parser.
|
183
|
-
|
184
|
-
- Updated to work correctly with Ruby 2.3.0.
|
185
|
-
|
186
|
-
## 2.2.2 - October 19, 2015
|
187
|
-
|
188
|
-
- Fixed problem with detecting invalid special character sequences.
|
189
|
-
|
190
|
-
- Fixed bug that caused a crash when an <> was encountered with the SAX parser.
|
191
|
-
|
192
|
-
## 2.2.1 - July 30, 2015
|
224
|
+
## [2.2.1] - 2015-07-30
|
193
225
|
|
226
|
+
### Fixed
|
194
227
|
- Added support to handle script elements in html.
|
195
228
|
|
196
229
|
- Added support for position from start for the sax parser.
|
197
230
|
|
198
|
-
## 2.2.0 -
|
231
|
+
## [2.2.0] - 2015-04-20
|
199
232
|
|
233
|
+
### Fixed
|
200
234
|
- Added the SAX convert_special option to the default options.
|
201
235
|
|
202
236
|
- Added the SAX smart option to the default options.
|
203
237
|
|
204
238
|
- Other SAX options are now taken from the defaults if not specified.
|
205
239
|
|
206
|
-
## 2.1.8 -
|
240
|
+
## [2.1.8] - 2015-02-10
|
207
241
|
|
242
|
+
### Fixed
|
208
243
|
- Fixed a bug that caused all input to be read before parsing with the sax
|
209
244
|
parser and an IO.pipe.
|
210
245
|
|
211
|
-
## 2.1.7 -
|
246
|
+
## [2.1.7] - 2015-01-31
|
212
247
|
|
248
|
+
### Fixed
|
213
249
|
- Empty elements such as <foo></foo> are now called back with empty text.
|
214
250
|
|
215
251
|
- Fixed GC problem that occurs with the new GC in Ruby 2.2 that garbage
|
216
252
|
collects Symbols.
|
217
253
|
|
218
|
-
## 2.1.6 - December
|
254
|
+
## [2.1.6] - 2014-December-31
|
219
255
|
|
256
|
+
### Fixed
|
220
257
|
- Update licenses. No other changes.
|
221
258
|
|
222
|
-
## 2.1.5 - December
|
259
|
+
## [2.1.5] - 2014-December-30
|
223
260
|
|
261
|
+
### Fixed
|
224
262
|
- Fixed symbol intern problem with Ruby 2.2.0. Symbols are not dynamic unless
|
225
263
|
rb_intern(). There does not seem to be a way to force symbols created with
|
226
264
|
encoding to be pinned.
|
227
265
|
|
228
|
-
## 2.1.4 - December
|
266
|
+
## [2.1.4] - 2014-December-5
|
229
267
|
|
268
|
+
### Fixed
|
230
269
|
- Fixed bug where the parser always started at the first position in a stringio
|
231
270
|
instead of the current position.
|
232
271
|
|
233
|
-
## 2.1.3 -
|
272
|
+
## [2.1.3] - 2014-07-25
|
234
273
|
|
274
|
+
### Fixed
|
235
275
|
- Added check for @attributes being nil. Reported by and proposed fix by Elana.
|
236
276
|
|
237
|
-
## 2.1.2 -
|
277
|
+
## [2.1.2] - 2014-07-17
|
238
278
|
|
279
|
+
### Fixed
|
239
280
|
- Added skip option to parsing. This allows white space to be collapsed in two
|
240
281
|
different ways.
|
241
282
|
|
242
283
|
- Added respond_to? method for easy access method checking.
|
243
284
|
|
244
|
-
## 2.1.1 -
|
285
|
+
## [2.1.1] - 2014-02-12
|
245
286
|
|
287
|
+
### Fixed
|
246
288
|
- Worked around a module reset and clear that occurs on some Rubies.
|
247
289
|
|
248
|
-
## 2.1.0 -
|
290
|
+
## [2.1.0] - 2014-02-2
|
249
291
|
|
292
|
+
### Fixed
|
250
293
|
- Thanks to jfontan Ox now includes support for XMLRPC.
|
251
294
|
|
252
|
-
## 2.0.12 -
|
295
|
+
## [2.0.12] - 2013-05-21
|
253
296
|
|
297
|
+
### Fixed
|
254
298
|
- Fixed problem compiling with latest version of Rubinius.
|
255
299
|
|
256
|
-
## 2.0.11 -
|
300
|
+
## [2.0.11] - 2013-10-17
|
257
301
|
|
302
|
+
### Fixed
|
258
303
|
- Added support for BigDecimals in :object mode.
|
259
304
|
|
260
|
-
## 2.
|
305
|
+
## [10.2.10]
|
261
306
|
|
307
|
+
### Fixed
|
262
308
|
- Small fix to not create an empty element from a closed element when using locate().
|
263
309
|
|
264
310
|
- Fixed to keep objects from being garbages collected in Ruby 2.x.
|
265
311
|
|
266
|
-
## 2.0.9 -
|
312
|
+
## [2.0.9] - 2013-09-2
|
267
313
|
|
314
|
+
### Fixed
|
268
315
|
- Fixed bug that did not allow ISO-8859-1 characters and caused a crash.
|
269
316
|
|
270
|
-
## 2.0.8 -
|
317
|
+
## [2.0.8] - 2013-08-6
|
271
318
|
|
319
|
+
### Fixed
|
272
320
|
- Allow single quoted strings in all modes.
|
273
321
|
|
274
|
-
## 2.0.7 -
|
322
|
+
## [2.0.7] - 2013-08-4
|
275
323
|
|
324
|
+
### Fixed
|
276
325
|
- Fixed DOCTYPE parsing to handle nested '>' characters.
|
277
326
|
|
278
|
-
## 2.0.6 -
|
327
|
+
## [2.0.6] - 2013-07-23
|
279
328
|
|
329
|
+
### Fixed
|
280
330
|
- Fixed bug in special character decoding that chopped of text.
|
281
331
|
|
282
332
|
- Limit depth on dump to 1000 to avoid core dump on circular references if the user does not specify circular.
|
283
333
|
|
284
334
|
- Handles dumping non-string values for attributes correctly by converting the value to a string.
|
285
335
|
|
286
|
-
## 2.0.5 -
|
336
|
+
## [2.0.5] - 2013-07-5
|
287
337
|
|
288
|
-
|
338
|
+
### Fixed
|
339
|
+
- Better support for special character encoding with 1.8.7.- February 8, 2013
|
289
340
|
|
290
|
-
## 2.0.4 -
|
341
|
+
## [2.0.4] - 2013-06-24
|
291
342
|
|
343
|
+
### Fixed
|
292
344
|
- Fixed SAX parser handling of &#nnnn; encoded characters.
|
293
345
|
|
294
|
-
## 2.0.3 -
|
346
|
+
## [2.0.3] - 2013-06-12
|
295
347
|
|
348
|
+
### Fixed
|
296
349
|
- Fixed excessive memory allocation issue for very large file parsing (half a gig).
|
297
350
|
|
298
|
-
## 2.0.2 -
|
351
|
+
## [2.0.2] - 2013-06-7
|
299
352
|
|
353
|
+
### Fixed
|
300
354
|
- Fixed buffer sliding window off by 1 error in the SAX parser.
|
301
355
|
|
302
|
-
## 2
|
356
|
+
## [1] -2-.0
|
303
357
|
|
358
|
+
### Fixed
|
304
359
|
- Added an attrs_done callback to the sax parser that will be called when all
|
305
360
|
attributes for an element have been read.
|
306
361
|
|
@@ -311,8 +366,9 @@
|
|
311
366
|
|
312
367
|
- Changed exception handling to assure proper cleanup with new stack minimizing.
|
313
368
|
|
314
|
-
## 2.0.0 -
|
369
|
+
## [2.0.0] - 2013-04-16
|
315
370
|
|
371
|
+
### Fixed
|
316
372
|
- The SAX parser went through a significant re-write. The options have changed. It is now 15% faster on large files and
|
317
373
|
much better at recovering from errors. So much so that the tolerant option was removed and is now the default and
|
318
374
|
only behavior. A smart option was added however. The smart option recognizes a file as an HTML file and will apply a
|
@@ -330,130 +386,155 @@
|
|
330
386
|
- A contrib directory was added for people to submit useful bits of code that can be used with Ox. The first
|
331
387
|
contributor is Notezen with a nice way of building XML.
|
332
388
|
|
333
|
-
## 1.9.4 -
|
389
|
+
## [1.9.4] - 2013-03-24
|
334
390
|
|
391
|
+
### Fixed
|
335
392
|
- SAX tolerant mode handle multiple elements in a document better.
|
336
393
|
|
337
|
-
## 1.9.3 -
|
394
|
+
## [1.9.3] - 2013-03-22
|
338
395
|
|
396
|
+
### Fixed
|
339
397
|
- mcarpenter fixed a compile problem with Cygwin.
|
340
398
|
|
341
399
|
- Now more tolerant when the :effort is set to :tolerant. Ox will let all sorts
|
342
400
|
of errors typical in HTML documents pass. The result may not be perfect but
|
343
401
|
at least parsed results are returned.
|
344
402
|
|
345
|
-
|
403
|
+
- Attribute values need not be quoted or they can be quoted with single
|
346
404
|
quotes or there can be no =value are all.
|
347
405
|
|
348
|
-
|
406
|
+
- Elements not terminated will be terminated by the next element
|
349
407
|
termination. This effect goes up until a match is found on the element
|
350
408
|
name.
|
351
409
|
|
352
410
|
- SAX parser also given a :tolerant option with the same tolerance as the string parser.
|
353
411
|
|
354
|
-
## 1.9.2 -
|
412
|
+
## [1.9.2] - 2013-03-9
|
355
413
|
|
414
|
+
### Fixed
|
356
415
|
- Fixed bug in the sax element name check that cause a memory write error.
|
357
416
|
|
358
|
-
## 1.9.1 -
|
417
|
+
## [1.9.1] - 2013-02-27
|
359
418
|
|
419
|
+
### Fixed
|
360
420
|
- Fixed the line numbers to be the start of the elements in the sax parser.
|
361
421
|
|
362
|
-
## 1.9.0 -
|
422
|
+
## [1.9.0] - 2013-02-25
|
363
423
|
|
424
|
+
### Fixed
|
364
425
|
- Added a new feature to Ox::Element.locate() that allows filtering by node Class.
|
365
426
|
|
366
427
|
- Added feature to the Sax parser. If @line is defined in the handler it is set to the line number of the xml file
|
367
428
|
before making callbacks. The same goes for @column but it is updated with the column.
|
368
429
|
|
369
|
-
## 1.8.9 -
|
430
|
+
## [1.8.9] - 2013-02-21
|
370
431
|
|
432
|
+
### Fixed
|
371
433
|
- Fixed bug in element start and end name checking.
|
372
434
|
|
373
|
-
## 1.8.8 -
|
435
|
+
## [1.8.8] - 2013-02-17
|
374
436
|
|
437
|
+
### Fixed
|
375
438
|
- Fixed bug in check for open and close element names matching.
|
376
439
|
|
377
|
-
## 1
|
440
|
+
## [7] -1-.8
|
378
441
|
|
442
|
+
### Fixed
|
379
443
|
- Added a correct check for element open and close names.
|
380
444
|
|
381
445
|
- Changed raised Exceptions to customer classes that inherit from StandardError.
|
382
446
|
|
383
447
|
- Fixed a few minor bugs.
|
384
448
|
|
385
|
-
## 1.8.6 -
|
449
|
+
## [1.8.6] - 2013-02-7
|
386
450
|
|
451
|
+
### Fixed
|
387
452
|
- Removed broken check for matching start and end element names in SAX mode. The names are still included in the
|
388
453
|
handler callbacks so the user can perform the check is desired.
|
389
454
|
|
390
|
-
## 1.8.5 -
|
455
|
+
## [1.8.5] - 2013-02-3
|
391
456
|
|
457
|
+
### Fixed
|
392
458
|
- added encoding support for JRuby where possible when in 1.9 mode.
|
393
459
|
|
394
|
-
## 1.8.4 -
|
460
|
+
## [1.8.4] - 2013-01-25
|
395
461
|
|
462
|
+
### Fixed
|
396
463
|
- Applied patch by mcarpenter to fix solaris issues with build and remaining undefined @nodes.
|
397
464
|
|
398
|
-
## 1.8.3 -
|
465
|
+
## [1.8.3] - 2013-01-24
|
399
466
|
|
467
|
+
### Fixed
|
400
468
|
- Sax parser now honors encoding specification in the xml prolog correctly.
|
401
469
|
|
402
|
-
## 1.8.2 -
|
470
|
+
## [1.8.2] - 2013-01-18
|
403
471
|
|
472
|
+
### Fixed
|
404
473
|
- Ox::Element.locate no longer raises and exception if there are no child nodes.
|
405
474
|
|
406
475
|
- Dumping an XML document no longer puts a carriage return after processing instructions.
|
407
476
|
|
408
|
-
## 1.8.1 - December
|
477
|
+
## [1.8.1] - 2012-December-17
|
409
478
|
|
479
|
+
### Fixed
|
410
480
|
- Fixed bug that caused a crash when an invalid xml with two elements and no <?xml?> was parsed. (issue #28)
|
411
481
|
|
412
482
|
- Modified the SAX parser to not strip white space from the start of string content.
|
413
483
|
|
414
|
-
## 1.8.0 - December
|
484
|
+
## [1.8.0] - 2012-December-11
|
415
485
|
|
486
|
+
### Fixed
|
416
487
|
- Added more complete support for processing instructions in both the generic parser and in the sax parser. This change includes and additional sax handler callback for the end of the instruction processing.
|
417
488
|
|
418
|
-
## 1.7.1 - December
|
489
|
+
## [1.7.1] - 2012-December-6
|
419
490
|
|
491
|
+
### Fixed
|
420
492
|
- Pulled in sharpyfox's changes to make Ox with with Windows. (issue #24)
|
421
493
|
|
422
494
|
- Fixed bug that ignored white space only text elements. (issue #26)
|
423
495
|
|
424
|
-
## 1.7.0 -
|
496
|
+
## [1.7.0] - 2012-11-27
|
425
497
|
|
498
|
+
### Fixed
|
426
499
|
- Added support for BOM in the SAX parser.
|
427
500
|
|
428
|
-
## 1.6.9 -
|
501
|
+
## [1.6.9] - 2012-11-25
|
429
502
|
|
503
|
+
### Fixed
|
430
504
|
- Added support for BOM. They are honored for and handled correctly for UTF-8. Others cause encoding issues with Ruby or raise an error as others are not ASCII compatible..
|
431
505
|
|
432
|
-
## 1.6.8 -
|
506
|
+
## [1.6.8] - 2012-11-18
|
433
507
|
|
508
|
+
### Fixed
|
434
509
|
- Changed extconf.rb to use RUBY_PLATFORM.
|
435
510
|
|
436
|
-
## 1.6.7 -
|
511
|
+
## [1.6.7] - 2012-11-15
|
437
512
|
|
513
|
+
### Fixed
|
438
514
|
- Now uses the encoding of the imput XML as the default encoding for the parsed output if the default options encoding is not set and the encoding is not set in the XML file prolog.
|
439
515
|
|
440
|
-
## 1.6.5 -
|
516
|
+
## [1.6.5] - 2012-10-25
|
441
517
|
|
518
|
+
### Fixed
|
442
519
|
- Special character handling now supports UCS-2 and UCS-4 Unicode characters as well as UTF-8 characters.
|
443
520
|
|
444
|
-
## 1.6.4 -
|
521
|
+
## [1.6.4] - 2012-10-24
|
445
522
|
|
523
|
+
### Fixed
|
446
524
|
- Special character handling has been improved. Both hex and base 10 numeric values are allowed up to a 64 bit number
|
447
525
|
for really long UTF-8 characters.
|
448
526
|
|
449
|
-
## 1.6.3 -
|
527
|
+
## [1.6.3] - 2012-10-22
|
450
528
|
|
529
|
+
### Fixed
|
451
530
|
- Fixed compatibility issues with Linux (Ubuntu) mostly related to pointer sizes.
|
452
531
|
|
453
|
-
## 1.6.2 -
|
532
|
+
## [1.6.2] - 2012-10-7
|
454
533
|
|
534
|
+
### Fixed
|
455
535
|
- Added check for Solaris and Linux builds to not use the timezone member of time struct (struct tm).
|
456
536
|
|
457
|
-
## 1.6.1 -
|
537
|
+
## [1.6.1] - 2012-10-7
|
458
538
|
|
539
|
+
### Fixed
|
459
540
|
- Added check for Solaris builds to not use the timezone member of time struct (struct tm).
|
data/ext/ox/builder.c
CHANGED
@@ -167,7 +167,7 @@ append_string(Builder b, const char *str, size_t size, const char *table, bool s
|
|
167
167
|
default:
|
168
168
|
// Must be one of the invalid characters.
|
169
169
|
if (!strip_invalid_chars) {
|
170
|
-
rb_raise(
|
170
|
+
rb_raise(ox_syntax_error_class, "'\\#x%02x' is not a valid XML character.", *str);
|
171
171
|
}
|
172
172
|
break;
|
173
173
|
}
|
data/ext/ox/dump.c
CHANGED
@@ -388,7 +388,7 @@ dump_str_value(Out out, const char *value, size_t size, const char *table) {
|
|
388
388
|
default:
|
389
389
|
// Must be one of the invalid characters.
|
390
390
|
if (StrictEffort == out->opts->effort) {
|
391
|
-
rb_raise(
|
391
|
+
rb_raise(ox_syntax_error_class, "'\\#x%02x' is not a valid XML character.", *value);
|
392
392
|
}
|
393
393
|
if (Yes == out->opts->allow_invalid) {
|
394
394
|
*out->cur++ = '&';
|
data/ext/ox/err.h
CHANGED
@@ -17,6 +17,7 @@ typedef struct _err {
|
|
17
17
|
|
18
18
|
extern VALUE ox_arg_error_class;
|
19
19
|
extern VALUE ox_parse_error_class;
|
20
|
+
extern VALUE ox_syntax_error_class;
|
20
21
|
|
21
22
|
extern void ox_err_set(Err e, VALUE clas, const char *format, ...);
|
22
23
|
extern void _ox_err_set_with_location(Err err, const char *msg, const char *xml, const char *current, const char* file, int line);
|
data/ext/ox/gen_load.c
CHANGED
@@ -90,7 +90,7 @@ create_prolog_doc(PInfo pi, const char *target, Attr attrs) {
|
|
90
90
|
volatile VALUE sym;
|
91
91
|
|
92
92
|
if (!helper_stack_empty(&pi->helpers)) { /* top level object */
|
93
|
-
ox_err_set(&pi->err,
|
93
|
+
ox_err_set(&pi->err, ox_syntax_error_class, "Prolog must be the first element in an XML document.\n");
|
94
94
|
return;
|
95
95
|
}
|
96
96
|
doc = rb_obj_alloc(ox_document_clas);
|
@@ -161,7 +161,7 @@ instruct(PInfo pi, const char *target, Attr attrs, const char *content) {
|
|
161
161
|
for (; 0 != attrs->name; attrs++) {
|
162
162
|
if (0 == strcmp("version", attrs->name)) {
|
163
163
|
if (0 != strcmp("1.0", attrs->value)) {
|
164
|
-
ox_err_set(&pi->err,
|
164
|
+
ox_err_set(&pi->err, ox_syntax_error_class, "Only Ox XML Object version 1.0 supported, not %s.\n", attrs->value);
|
165
165
|
return;
|
166
166
|
}
|
167
167
|
}
|
@@ -180,7 +180,7 @@ nomode_instruct(PInfo pi, const char *target, Attr attrs, const char *content) {
|
|
180
180
|
for (; 0 != attrs->name; attrs++) {
|
181
181
|
if (0 == strcmp("version", attrs->name)) {
|
182
182
|
if (0 != strcmp("1.0", attrs->value)) {
|
183
|
-
ox_err_set(&pi->err,
|
183
|
+
ox_err_set(&pi->err, ox_syntax_error_class, "Only Ox XML Object version 1.0 supported, not %s.\n", attrs->value);
|
184
184
|
return;
|
185
185
|
}
|
186
186
|
} else if (0 == strcmp("mode", attrs->name)) {
|
@@ -195,7 +195,7 @@ nomode_instruct(PInfo pi, const char *target, Attr attrs, const char *content) {
|
|
195
195
|
pi->obj = Qnil;
|
196
196
|
helper_stack_init(&pi->helpers);
|
197
197
|
} else {
|
198
|
-
ox_err_set(&pi->err,
|
198
|
+
ox_err_set(&pi->err, ox_syntax_error_class, "%s is not a valid processing instruction mode.\n", attrs->value);
|
199
199
|
return;
|
200
200
|
}
|
201
201
|
}
|
data/ext/ox/ox.c
CHANGED
@@ -102,6 +102,7 @@ VALUE ox_instruct_clas;
|
|
102
102
|
VALUE ox_parse_error_class;
|
103
103
|
VALUE ox_stringio_class;
|
104
104
|
VALUE ox_struct_class;
|
105
|
+
VALUE ox_syntax_error_class;
|
105
106
|
VALUE ox_time_class;
|
106
107
|
|
107
108
|
Cache ox_symbol_cache = 0;
|
@@ -977,7 +978,7 @@ load_file(int argc, VALUE *argv, VALUE self) {
|
|
977
978
|
char *path;
|
978
979
|
char *xml;
|
979
980
|
FILE *f;
|
980
|
-
|
981
|
+
off_t len;
|
981
982
|
VALUE obj;
|
982
983
|
struct _err err;
|
983
984
|
|
@@ -988,7 +989,7 @@ load_file(int argc, VALUE *argv, VALUE self) {
|
|
988
989
|
rb_raise(rb_eIOError, "%s\n", strerror(errno));
|
989
990
|
}
|
990
991
|
fseek(f, 0, SEEK_END);
|
991
|
-
len =
|
992
|
+
len = ftello(f);
|
992
993
|
if (SMALL_XML < len) {
|
993
994
|
xml = ALLOC_N(char, len + 1);
|
994
995
|
} else {
|
@@ -1454,6 +1455,7 @@ void Init_ox() {
|
|
1454
1455
|
ox_time_class = rb_const_get(rb_cObject, rb_intern("Time"));
|
1455
1456
|
ox_date_class = rb_const_get(rb_cObject, rb_intern("Date"));
|
1456
1457
|
ox_parse_error_class = rb_const_get_at(Ox, rb_intern("ParseError"));
|
1458
|
+
ox_syntax_error_class = rb_const_get_at(Ox, rb_intern("SyntaxError"));
|
1457
1459
|
ox_arg_error_class = rb_const_get_at(Ox, rb_intern("ArgError"));
|
1458
1460
|
ox_struct_class = rb_const_get(rb_cObject, rb_intern("Struct"));
|
1459
1461
|
ox_stringio_class = rb_const_get(rb_cObject, rb_intern("StringIO"));
|
data/ext/ox/sax_buf.c
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
#include <strings.h>
|
10
10
|
#include <sys/types.h>
|
11
11
|
#if NEEDS_UIO
|
12
|
-
#include <sys/uio.h>
|
12
|
+
#include <sys/uio.h>
|
13
13
|
#endif
|
14
14
|
#include <unistd.h>
|
15
15
|
#include <time.h>
|
@@ -84,7 +84,7 @@ ox_sax_buf_read(Buf buf) {
|
|
84
84
|
if (0 >= shift) { /* no space left so allocate more */
|
85
85
|
char *old = buf->head;
|
86
86
|
size_t size = buf->end - buf->head + BUF_PAD;
|
87
|
-
|
87
|
+
|
88
88
|
if (buf->head == buf->base) {
|
89
89
|
buf->head = ALLOC_N(char, size * 2);
|
90
90
|
memcpy(buf->head, old, size);
|
@@ -126,7 +126,7 @@ rescue_cb(VALUE rbuf, VALUE err) {
|
|
126
126
|
Buf buf = (Buf)rbuf;
|
127
127
|
|
128
128
|
//ox_sax_drive_cleanup(buf->dr); called after exiting protect
|
129
|
-
rb_raise(err, "at line %
|
129
|
+
rb_raise(err, "at line %ld, column %ld\n", (long)buf->line, (long)buf->col);
|
130
130
|
}
|
131
131
|
return Qfalse;
|
132
132
|
}
|
@@ -225,4 +225,3 @@ read_from_str(Buf buf) {
|
|
225
225
|
|
226
226
|
return 0;
|
227
227
|
}
|
228
|
-
|
data/ext/ox/sax_buf.h
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
#ifndef OX_SAX_BUF_H
|
7
7
|
#define OX_SAX_BUF_H
|
8
8
|
|
9
|
+
#include <stdio.h>
|
10
|
+
|
9
11
|
typedef struct _buf {
|
10
12
|
char base[0x00001000];
|
11
13
|
char *head;
|
@@ -14,12 +16,12 @@ typedef struct _buf {
|
|
14
16
|
char *read_end; /* one past last character read */
|
15
17
|
char *pro; /* protection start, buffer can not slide past this point */
|
16
18
|
char *str; /* start of current string being read */
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
off_t pos;
|
20
|
+
off_t line;
|
21
|
+
off_t col;
|
22
|
+
off_t pro_pos;
|
23
|
+
off_t pro_line;
|
24
|
+
off_t pro_col;
|
23
25
|
int (*read_func)(struct _buf *buf);
|
24
26
|
union {
|
25
27
|
int fd;
|
@@ -30,10 +32,10 @@ typedef struct _buf {
|
|
30
32
|
} *Buf;
|
31
33
|
|
32
34
|
typedef struct _checkPt {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
off_t pro_dif;
|
36
|
+
off_t pos;
|
37
|
+
off_t line;
|
38
|
+
off_t col;
|
37
39
|
char c;
|
38
40
|
} *CheckPt;
|
39
41
|
|
data/lib/ox/error.rb
CHANGED
@@ -13,6 +13,10 @@ module Ox
|
|
13
13
|
class ArgError < Error
|
14
14
|
end # ArgError
|
15
15
|
|
16
|
+
# An Exception that is raised as a result of invalid XML syntax.
|
17
|
+
class SyntaxError < Error
|
18
|
+
end
|
19
|
+
|
16
20
|
# An Exception raised if a path is not valid.
|
17
21
|
class InvalidPath < Error
|
18
22
|
# Create a new instance with the +path+ specified.
|
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.11.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: 2019-
|
11
|
+
date: 2019-06-14 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
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.0.
|
102
|
+
rubygems_version: 3.0.1
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: A fast XML parser and object serializer.
|