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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6e57cf5b8fbaa41d750b25f77a81d329f58465115db0c628dd97ba4b0bf97b3
4
- data.tar.gz: df2f0ba360c0c6f5ea0ac23496ce133a8008c78c5a2a7e3a9078b7138ee957b9
3
+ metadata.gz: 837c0ef02149244d49ab2779216dbafc40c46cf1af3354d6ef35779929176476
4
+ data.tar.gz: b749a74dee9e1ff268cf69ca6dfff6edcb5681e2c4abe90a07a10442689cc484
5
5
  SHA512:
6
- metadata.gz: 2dbff602131c14cde1d7b754165fee62867f5b27956c01de1a52a119f651bcaa8457e92c900cc2a121f74cfdcfbadbeec74a9f144e450f1b24805bd0167e3d14
7
- data.tar.gz: 40392d27cec2d85d4df7deae4870da0da2fabf3a96b761a4f8e95d0813b99763c5dd7cdb76a4c8a139ccf613868a04d7ded091fa68db1e89fdfa5ee49b118a6e
6
+ metadata.gz: f18d97d2e7c3087a07983f32b4d1e061e46866e5d17734689e8af68c8c004b669c008cb7321246123b060d44099624e2c039065727886ba146a412a7f8cae166
7
+ data.tar.gz: 90f9b3fcc779a2ac25e7a317a3fa17f028c4f9008bb8e57c6dc26693965add3cb116f7e9b250d64038f9928d027ee178f7e633320152202f94a1d896edff6f63
@@ -1,306 +1,361 @@
1
+ # Changelog
1
2
 
2
- ## 2.10.1 - May 27, 2019
3
+ All changes to the Ox gem are documented here. Releases follow semantic versioning.
3
4
 
4
- - Remove extra space from doctype dump.
5
+ ## [Unreleased]
5
6
 
6
- ## 2.10.0 - August 26, 2018
7
+ ## [2.11.0] - 2019-06-14
7
8
 
8
- - `:element_key_mod` and `:attr_key_mod` options were added to allow keys to
9
- be modified when loading.
9
+ ### Changed
10
+ - Ox::SyntaxError replaces SyntaxError where such an exception would have previously been raised.
10
11
 
11
- ## 2.9.4 - July 16, 2018
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
- - Fixed issue with malformed object mode input.
17
+ ## [2.10.1] - 2019-05-27
14
18
 
15
- ## 2.9.3 - June 12, 2018
19
+ ### Fixed
20
+ - Remove extra space from doctype dump.
16
21
 
17
- - Handle `\0` in dumped strings better.
22
+ ## [2.10.0] - 2018-08-26
18
23
 
19
- - No `\n` added on dumped if indent is less than zero.
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.2 - April 16, 2018
27
+ ## [2.9.4] - 2018-07-16
22
28
 
23
- - `locate` fixed to cover a missing condition with named child thanks to mberlanda.
29
+ ### Fixed
30
+ - Fixed issue with malformed object mode input.
24
31
 
25
- - `locate` supports attribute exists searches thanks to mberlanda.
32
+ ## [2.9.3] - 2018-06-12
26
33
 
27
- ## 2.9.1 - April 14, 2018
34
+ ### Fixed
35
+ - Handle `\0` in dumped strings better.
36
+ - No `\n` added on dumped if indent is less than zero.
28
37
 
29
- - `prepend_child` added by mberlanda.
38
+ ## [2.9.2] - 2018-04-16
30
39
 
31
- ## 2.9.0 - March 13, 2018
40
+ ### Fixed
41
+ - `locate` fixed to cover a missing condition with named child thanks to mberlanda.
32
42
 
33
- - New builder methods for building HTML.
43
+ ### Added
44
+ - `locate` supports attribute exists searches thanks to mberlanda.
34
45
 
35
- - Examples added.
46
+ ## [2.9.1] - 2018-04-14
36
47
 
37
- ## 2.8.4 - March 4, 2018
48
+ ### Fixed
49
+ - `prepend_child` added by mberlanda.
38
50
 
39
- - Commented out debuf statement.
51
+ ## [2.9.0] - 2018-03-13
40
52
 
41
- ## 2.8.3 - March 3, 2018
53
+ ### Added
54
+ - New builder methods for building HTML.
55
+ - Examples added.
42
56
 
43
- - Attribute values now escape < and > on dump.
57
+ ## [2.8.4] - 2018-03-4
44
58
 
45
- ## 2.8.2 - November 1, 2017
59
+ ### Fixed
60
+ - Commented out debug statement.
46
61
 
47
- - Fixed bug with SAX parser that caused a crash with very long invalid instruction element.
62
+ ## [2.8.3] - 2018-03-3
48
63
 
49
- - Fixed SAX parse error with double <source> elements.
64
+ ### Fixed
65
+ - Attribute values now escape < and > on dump.
50
66
 
51
- ## 2.8.1 - October 27, 2017
67
+ ## [2.8.2] - 2017-11-1
52
68
 
53
- - Avoid crash with invalid XML passed to Ox.parse_obj().
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.0 - September 22, 2017
73
+ ## [2.8.1] - 2017-10-27
56
74
 
57
- - Added :skip_off mode to make sax callback on every none empty string even
58
- if there are not other non-whitespace characters present.
75
+ ### Fixed
76
+ - Avoid crash with invalid XML passed to Ox.parse_obj().
59
77
 
60
- ## 2.7.0 - August 18, 2017
78
+ ## [2.8.0] - 2017-09-22
61
79
 
62
- - Two new load modes added, :hash and :hash_no_attrs. Both load an XML
63
- document to create a Hash populated with core Ruby objects.
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
- - Worked around Ruby API change for RSTRUCT_LEN so Ruby 2.4.2 does not crash.
83
+ ## [2.7.0] - 2017-08-18
66
84
 
67
- ## 2.6.0 - August 9, 2017
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
- - The Element#each() method was added to allow iteration over Element nodes conditionally.
88
+ ### Fixed
89
+ - Worked around Ruby API change for RSTRUCT_LEN so Ruby 2.4.2 does not crash.
70
90
 
71
- - Element#locate() now supports a [@attr=value] specification.
91
+ ## [2.6.0] - 2017-08-9
72
92
 
73
- - 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.
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 - May 4, 2017
98
+ ## [2.5.0] - 2017-05-4
76
99
 
77
- - Set the default for skip to be to skip white space.
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
- - Added a :nest_ok option to SAX hints that will ignore the nested check on a
80
- tag to accomadate non-compliant HTML.
103
+ ### Changed
104
+ - Set the default for skip to be to skip white space.
81
105
 
82
- ## 2.4.13 - April 21, 2017
106
+ ## [2.4.13] - 2017-04-21
83
107
 
84
- - Corrected Builder special character handling.
108
+ ### Fixed
109
+ - Corrected Builder special character handling.
85
110
 
86
- ## 2.4.12 - April 11, 2017
111
+ ## [2.4.12] - 2017-04-11
87
112
 
88
- - Fixed position in builder when encoding special characters.
113
+ ### Fixed
114
+ - Fixed position in builder when encoding special characters.
89
115
 
90
- ## 2.4.11 - March 19, 2017
116
+ ## [2.4.11] - 2017-03-19
91
117
 
92
- - Fixed SAX parser bug regarding upper case hints not matching.
118
+ ### Fixed
119
+ - Fixed SAX parser bug regarding upper case hints not matching.
93
120
 
94
- ## 2.4.10 - February 13, 2017
121
+ ## [2.4.10] - 2017-02-13
95
122
 
96
- - Dump is now smarter about which characters to replace with &xxx; alternatives.
123
+ ### Fixed
124
+ - Dump is now smarter about which characters to replace with &xxx; alternatives.
97
125
 
98
- ## 2.4.9 - January 25, 2017
126
+ ## [2.4.9] - 2017-01-25
99
127
 
100
- - Added a SAX hint that allows comments to be treated like other elements.
128
+ ### Added
129
+ - Added a SAX hint that allows comments to be treated like other elements.
101
130
 
102
- ## 2.4.8 - January 15, 2017
131
+ ## [2.4.8] - 2017-01-15
103
132
 
104
- - Tolerant mode now allows case-insensitve matches on elements during
105
- parsing. Smart mode in the SAX parser is also case insensitive.
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 25, 2016
136
+ ## [2.4.7] - 2016-December-25
108
137
 
109
- - After encountering a <> the SAX parser will continue parsing after reporting an error.
138
+ ### Fixed
139
+ - After encountering a <> the SAX parser will continue parsing after reporting an error.
110
140
 
111
- ## 2.4.6 - November 28, 2016
141
+ ## [2.4.6] - 2016-11-28
112
142
 
113
- - Added margin option to dump.
143
+ ### Added
144
+ - Added margin option to dump.
114
145
 
115
- ## 2.4.5 - September 11, 2016
146
+ ## [2.4.5] - 2016-09-11
116
147
 
117
- - Thanks to GUI for fixing an infinite loop in Ox::Builder.
148
+ ### Fixed
149
+ - Thanks to GUI for fixing an infinite loop in Ox::Builder.
118
150
 
119
- ## 2.4.4 - August 9, 2016
151
+ ## [2.4.4] - 2016-08-9
120
152
 
121
- - Builder element attributes with special characters are now encoded correctly.
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
- - A newline at end of an XML string is now controlled by the indent value. A
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
- ## 2.4.3 - June 26, 2016
159
+ ### Fixed
160
+ - Fixed compiler warnings and errors.
161
+ - Updated for Ruby 2.4.0.
128
162
 
129
- - Fixed compiler warnings and errors.
163
+ ## [2.4.2] - 2016-06-23
130
164
 
131
- - Updated for Ruby 2.4.0.
165
+ ### Fixed
166
+ - Added methods to Ox::Builder to provide output position information.
132
167
 
133
- ## 2.4.2 - June 23, 2016
168
+ ## [2.4.1] - 2016-04-30
134
169
 
135
- - Added methods to Ox::Builder to provide output position information.
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
- ## 2.4.1 - April 30, 2016
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
- - Made SAX smarter a little smarter or rather let it handle unquoted string
140
- with a / at the end.
178
+ ## [2.4.0] - 2016-04-14
141
179
 
142
- - Fixed bug with reporting errors of element names that are too long.
180
+ ### Fixed
181
+ - Added Ox::Builder that constructs an XML string or writes XML to a stream using builder methods.
143
182
 
144
- - Added overlay feature to give control over which elements generate callbacks
145
- with the SAX parser.
183
+ ## [2.3.0] - 2016-02-21
146
184
 
147
- - Element.locate now includes self if the path is relative and starts with a wildcard.
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
- ## 2.4.0 - April 14, 2016
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
- - Added Ox::Builder that constructs an XML string or writes XML to a stream
152
- using builder methods.
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.3.0 - February 21, 2016
200
+ ## [2.2.4] - 2016-02-4
155
201
 
156
- - Added Ox::Element.replace_text() method.
202
+ ### Fixed
203
+ - Changed the code to allow compilation on older compilers. No change in
204
+ functionality otherwise.
157
205
 
158
- - Ox::Element nodes variable is now always initialized to an empty Array.
206
+ ## [2.2.3] - 2015-December-31
159
207
 
160
- - Ox::Element attributes variable is now always initialized to an empty Hash.
208
+ ### Fixed
209
+ - The convert_special option now applies to attributes as well as elements in
210
+ the SAX parser.
161
211
 
162
- - A invalid_replace option has been added. It will replace invalid XML
163
- character with a provided string. Strict effort now raises an exception if an
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
- - Ox.load and Ox.parse now allow for a callback block to handle multiple top
167
- level entities in the input.
215
+ - Updated to work correctly with Ruby 2.3.0.
168
216
 
169
- - The Ox SAX parser now supports strings as input directly without and IO wrapper.
217
+ ## [2.2.2] - 2015-10-19
170
218
 
171
- ## 2.2.4 - February 4, 2016
219
+ ### Fixed
220
+ - Fixed problem with detecting invalid special character sequences.
172
221
 
173
- - Changed the code to allow compilation on older compilers. No change in
174
- functionality otherwise.
222
+ - Fixed bug that caused a crash when an <> was encountered with the SAX parser.
175
223
 
176
- ## 2.2.3 - December 31, 2015
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 - April 20, 2015
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 - February 10, 2015
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 - January 31, 2015
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 31, 2014
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 30, 2014
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 5, 2014
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 - July 25, 2014
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 - July 17, 2014
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 - February 12, 2014
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 - February 2, 2014
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 - December 1, 2013 - May 21, 2013
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 - October 17, 2013
300
+ ## [2.0.11] - 2013-10-17
257
301
 
302
+ ### Fixed
258
303
  - Added support for BigDecimals in :object mode.
259
304
 
260
- ## 2.0.10
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 - September 2, 2013
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 - August 6, 2013
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 - August 4, 2013
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 - July 23, 2013
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 - July 5, 2013
336
+ ## [2.0.5] - 2013-07-5
287
337
 
288
- - Better support for special character encoding with 1.8.7. - February 8, 2013
338
+ ### Fixed
339
+ - Better support for special character encoding with 1.8.7.- February 8, 2013
289
340
 
290
- ## 2.0.4 - June 24, 2013
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 - June 12, 2013
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 - June 7, 2013
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.0.1
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 - April 16, 2013
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 - March 24, 2013
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 - March 22, 2013
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
- - Attribute values need not be quoted or they can be quoted with single
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
- - Elements not terminated will be terminated by the next element
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 - March 9, 2013
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 - February 27, 2013
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 - February 25, 2013
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 - February 21, 2013
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 - February 17, 2013
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.8.7
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 - February 7, 2013
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 - February 3, 2013
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 - January 25, 2013
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 - January 24, 2013
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 - January 18, 2013
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 17, 2012
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 11, 2012
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 6, 2012
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 - November 27, 2012
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 - November 25, 2012
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 - November 18, 2012
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 - November 15, 2012
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 - October 25, 2012
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 - October 24, 2012
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 - October 22, 2012
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 - October 7, 2012
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 - October 7, 2012
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).
@@ -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(rb_eSyntaxError, "'\\#x%02x' is not a valid XML character.", *str);
170
+ rb_raise(ox_syntax_error_class, "'\\#x%02x' is not a valid XML character.", *str);
171
171
  }
172
172
  break;
173
173
  }
@@ -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(rb_eSyntaxError, "'\\#x%02x' is not a valid XML character.", *value);
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++ = '&';
@@ -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);
@@ -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, rb_eSyntaxError, "Prolog must be the first element in an XML document.\n");
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, rb_eSyntaxError, "Only Ox XML Object version 1.0 supported, not %s.\n", attrs->value);
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, rb_eSyntaxError, "Only Ox XML Object version 1.0 supported, not %s.\n", attrs->value);
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, rb_eSyntaxError, "%s is not a valid processing instruction mode.\n", attrs->value);
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
  }
@@ -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
- size_t len;
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 = ftell(f);
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"));
@@ -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 %d, column %d\n", buf->line, buf->col);
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
-
@@ -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
- int pos;
18
- int line;
19
- int col;
20
- int pro_pos;
21
- int pro_line;
22
- int pro_col;
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
- int pro_dif;
34
- int pos;
35
- int line;
36
- int col;
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
 
@@ -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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '2.10.1'
4
+ VERSION = '2.11.0'
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.10.1
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-05-27 00:00:00.000000000 Z
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.3
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.