ox 1.9.3 → 1.9.4

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.

Files changed (4) hide show
  1. data/README.md +4 -0
  2. data/ext/ox/sax.c +10 -2
  3. data/lib/ox/version.rb +1 -1
  4. metadata +2 -2
data/README.md CHANGED
@@ -34,6 +34,10 @@ 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.9.4
38
+
39
+ - SAX tolerant mode handle multiple elements in a document better.
40
+
37
41
  ### Release 1.9.3
38
42
 
39
43
  - mcarpenter fixed a compile problem with Cygwin.
@@ -548,7 +548,11 @@ read_children(SaxDrive dr, int first) {
548
548
  err = ('\0' == read_name_token(dr));
549
549
  dr->line = line;
550
550
  dr->col = col;
551
- return err;
551
+ if (first && dr->tolerant) {
552
+ sax_drive_error(dr, "invalid format, unmatched element end", 0);
553
+ } else {
554
+ return err;
555
+ }
552
556
  break;
553
557
  case '\0':
554
558
  sax_drive_error(dr, "invalid format, document not terminated", 1);
@@ -560,6 +564,10 @@ read_children(SaxDrive dr, int first) {
560
564
  sax_drive_error(dr, "invalid format, multiple top level elements", 0);
561
565
  }
562
566
  err = read_element(dr);
567
+ if (NAME_MISMATCH == err && dr->tolerant && first) {
568
+ // must have been a end element with no matching start
569
+ err = 0;
570
+ }
563
571
  element_read = 1;
564
572
  break;
565
573
  }
@@ -926,6 +934,7 @@ read_element(SaxDrive dr) {
926
934
  if (dr->has_column) {
927
935
  rb_ivar_set(dr->handler, ox_at_column_id, INT2FIX(col));
928
936
  }
937
+ sax_drive_error(dr, "invalid format, element start and end names do not match", 1);
929
938
  //printf("*** ename: %s close: %s\n", ename, dr->str);
930
939
  if (dr->tolerant) {
931
940
  if (0 != dr->has_end_element) {
@@ -942,7 +951,6 @@ read_element(SaxDrive dr) {
942
951
  }
943
952
  return NAME_MISMATCH; // dr->str is still the name
944
953
  } else {
945
- sax_drive_error(dr, "invalid format, element start and end names do not match", 1);
946
954
  return -1;
947
955
  }
948
956
  }
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '1.9.3'
4
+ VERSION = '1.9.4'
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.9.3
4
+ version: 1.9.4
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: 2013-03-22 00:00:00.000000000 Z
12
+ date: 2013-03-24 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