ox 1.7.0 → 1.7.1

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.

data/README.md CHANGED
@@ -34,13 +34,11 @@ A fast XML parser and Object marshaller as a Ruby gem.
34
34
 
35
35
  ## <a name="release">Release Notes</a>
36
36
 
37
- ### Release 1.7.0
37
+ ### Release 1.7.1
38
38
 
39
- - Added support for BOM in the SAX parser.
39
+ - Pulled in sharpyfox's changes to make Ox with with Windows. (issue #24)
40
40
 
41
- ### Release 1.6.9
42
-
43
- - 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.
41
+ - Fixed bug that ignored white space only text elements. (issue #26)
44
42
 
45
43
  ## <a name="description">Description</a>
46
44
 
@@ -20,7 +20,7 @@ dflags = {
20
20
  'HAS_RB_TIME_TIMESPEC' => ('ruby' == type && ('1.9.3' == RUBY_VERSION)) ? 1 : 0,
21
21
  #'HAS_RB_TIME_TIMESPEC' => ('ruby' == type && ('1.9.3' == RUBY_VERSION || '2' <= version[0])) ? 1 : 0,
22
22
  'HAS_TM_GMTOFF' => ('ruby' == type && (('1' == version[0] && '9' == version[1]) || '2' <= version[0]) &&
23
- !(platform.include?('solaris') || platform.include?('linux'))) ? 1 : 0,
23
+ !(platform.include?('solaris') || platform.include?('linux') || RUBY_PLATFORM =~ /(win|w)32$/)) ? 1 : 0,
24
24
  'HAS_ENCODING_SUPPORT' => (('ruby' == type || 'rubinius' == type) &&
25
25
  (('1' == version[0] && '9' == version[1]) || '2' <= version[0])) ? 1 : 0,
26
26
  'HAS_NANO_TIME' => ('ruby' == type && ('1' == version[0] && '9' == version[1]) || '2' <= version[0]) ? 1 : 0,
@@ -28,11 +28,15 @@ dflags = {
28
28
  'HAS_IVAR_HELPERS' => ('ruby' == type && ('1' == version[0] && '9' == version[1]) || '2' <= version[0]) ? 1 : 0,
29
29
  'HAS_PROC_WITH_BLOCK' => ('ruby' == type && ('1' == version[0] && '9' == version[1]) || '2' <= version[0]) ? 1 : 0,
30
30
  'HAS_TOP_LEVEL_ST_H' => ('ree' == type || ('ruby' == type && '1' == version[0] && '8' == version[1])) ? 1 : 0,
31
+ 'NEEDS_UIO' => (RUBY_PLATFORM =~ /(win|w)32$/) ? 0 : 1,
31
32
  }
32
33
 
34
+ if RUBY_PLATFORM =~ /(win|w)32$/
35
+ dflags['NEEDS_STPCPY'] = nil
36
+ end
37
+
33
38
  if ['i386-darwin10.0.0', 'x86_64-darwin10.8.0'].include? RUBY_PLATFORM
34
39
  dflags['NEEDS_STPCPY'] = nil
35
-
36
40
  dflags['HAS_IVAR_HELPERS'] = 0 if ('ruby' == type && '1.9.1' == RUBY_VERSION)
37
41
  elsif 'x86_64-linux' == RUBY_PLATFORM && '1.9.3' == RUBY_VERSION && '2011-10-30' == RUBY_RELEASE_DATE
38
42
  begin
@@ -377,6 +377,7 @@ read_element(PInfo pi) {
377
377
  }
378
378
  if (hasChildren) {
379
379
  char *start;
380
+ int first = 1;
380
381
 
381
382
  done = 0;
382
383
  /* read children */
@@ -388,6 +389,8 @@ read_element(PInfo pi) {
388
389
  raise_error("invalid format, document not terminated", pi->str, pi->s);
389
390
  }
390
391
  if ('<' == c) {
392
+ char *slash;
393
+
391
394
  switch (*pi->s) {
392
395
  case '!': /* better be a comment or CDATA */
393
396
  pi->s++;
@@ -402,6 +405,7 @@ read_element(PInfo pi) {
402
405
  }
403
406
  break;
404
407
  case '/':
408
+ slash = pi->s;
405
409
  pi->s++;
406
410
  name = read_name_token(pi);
407
411
  end = pi->s;
@@ -414,12 +418,18 @@ read_element(PInfo pi) {
414
418
  if ('>' != c) {
415
419
  raise_error("invalid format, element not closed", pi->str, pi->s);
416
420
  }
421
+ if (first && start != slash - 1) {
422
+ /* some white space between start and here so add as text */
423
+ *(slash - 1) = '\0';
424
+ pi->pcb->add_text(pi, start, 1);
425
+ }
417
426
  pi->s++;
418
427
  pi->pcb->end_element(pi, ename);
419
428
  return;
420
429
  case '\0':
421
430
  raise_error("invalid format, document not terminated", pi->str, pi->s);
422
431
  default:
432
+ first = 0;
423
433
  /* a child element */
424
434
  read_element(pi);
425
435
  break;
@@ -33,7 +33,9 @@
33
33
  #include <stdio.h>
34
34
  #include <strings.h>
35
35
  #include <sys/types.h>
36
- #include <sys/uio.h>
36
+ #if NEEDS_UIO
37
+ #include <sys/uio.h>
38
+ #endif
37
39
  #include <unistd.h>
38
40
  #include <time.h>
39
41
 
@@ -161,8 +161,10 @@ module Ox
161
161
  i -= 1
162
162
  end
163
163
  end
164
- return @attributes[id] if @attributes.has_key?(id)
165
- return @attributes[ids] if @attributes.has_key?(ids)
164
+ if instance_variable_defined?(:@attributes)
165
+ return @attributes[id] if @attributes.has_key?(id)
166
+ return @attributes[ids] if @attributes.has_key?(ids)
167
+ end
166
168
  raise NoMethodError.new("#{name} not found", name)
167
169
  end
168
170
 
@@ -172,10 +174,12 @@ module Ox
172
174
  step = path[0]
173
175
  if step.start_with?('@') # attribute
174
176
  raise InvalidPath.new(path) unless 1 == path.size
175
- step = step[1..-1]
176
- sym_step = step.to_sym
177
- @attributes.each do |k,v|
178
- found << v if ('?' == step or k == step or k == sym_step)
177
+ if instance_variable_defined?(:@attributes)
178
+ step = step[1..-1]
179
+ sym_step = step.to_sym
180
+ @attributes.each do |k,v|
181
+ found << v if ('?' == step or k == step or k == sym_step)
182
+ end
179
183
  end
180
184
  else # element name
181
185
  if (i = step.index('[')).nil? # just name
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '1.7.0'
4
+ VERSION = '1.7.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-27 00:00:00.000000000 Z
12
+ date: 2012-12-06 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! "A fast XML parser and object serializer that uses only standard C
15
15
  lib.\n \nOptimized XML (Ox), as the name implies was written to provide