ox 2.4.7 → 2.4.8
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.
- checksums.yaml +4 -4
- data/README.md +5 -6
- data/ext/ox/parse.c +5 -3
- data/ext/ox/sax.c +15 -8
- data/lib/ox/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0fbd4706902b82c9a1fcc1924f68b6a5b9b805f
|
4
|
+
data.tar.gz: aeef28c3236af992af9dff8cde459e59ead7b4b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3be6d1b77ea5a0426bd7ab5f2d127632af4586ae48f67a415ba2526465934ca66f685c16d195eeabe3047d06a43e59886731c1a3e1f0e37a9c5ceb2fdc2913ec
|
7
|
+
data.tar.gz: d29da0a404709c726fc296d7b929783400706135bbc32d13aec1ec5e2edc716996b9ce3c4816329dd4546fa73f234d407307ed14f56b3ba94d880c7f3f51e110
|
data/README.md
CHANGED
@@ -34,15 +34,14 @@ A fast XML parser and Object marshaller as a Ruby gem.
|
|
34
34
|
|
35
35
|
## Release Notes
|
36
36
|
|
37
|
-
### Release 2.4.
|
38
|
-
|
39
|
-
- After encountering a <> the SAX parser will continue parsing after reporting an error.
|
37
|
+
### Release 2.4.8
|
40
38
|
|
41
|
-
|
39
|
+
- Tolerant mode now allows case-insensitve matches on elements during
|
40
|
+
parsing. Smart mode in the SAX parser is also case insensitive.
|
42
41
|
|
43
|
-
|
42
|
+
### Release 2.4.7
|
44
43
|
|
45
|
-
-
|
44
|
+
- After encountering a <> the SAX parser will continue parsing after reporting an error.
|
46
45
|
|
47
46
|
## Description
|
48
47
|
|
data/ext/ox/parse.c
CHANGED
@@ -556,7 +556,7 @@ read_element(PInfo pi) {
|
|
556
556
|
next_non_white(pi);
|
557
557
|
c = *pi->s;
|
558
558
|
*end = '\0';
|
559
|
-
if (0 != strcmp(name, ename)) {
|
559
|
+
if (0 != ((TolerantEffort == pi->options->effort) ? strcasecmp(name, ename) : strcmp(name, ename))) {
|
560
560
|
attr_stack_cleanup(&attrs);
|
561
561
|
if (TolerantEffort == pi->options->effort) {
|
562
562
|
pi->pcb->end_element(pi, ename);
|
@@ -617,7 +617,8 @@ read_element(PInfo pi) {
|
|
617
617
|
// Child closed with mismatched name.
|
618
618
|
if (0 != (name = read_element(pi))) {
|
619
619
|
attr_stack_cleanup(&attrs);
|
620
|
-
|
620
|
+
|
621
|
+
if (0 == ((TolerantEffort == pi->options->effort) ? strcasecmp(name, ename) : strcmp(name, ename))) {
|
621
622
|
pi->s++;
|
622
623
|
pi->pcb->end_element(pi, ename);
|
623
624
|
return 0;
|
@@ -638,8 +639,9 @@ read_element(PInfo pi) {
|
|
638
639
|
|
639
640
|
/* to exit read_text with no errors the next character must be < */
|
640
641
|
if ('/' == *(pi->s + 1) &&
|
641
|
-
0 == strncmp(ename, pi->s + 2, elen) &&
|
642
|
+
0 == ((TolerantEffort == pi->options->effort) ? strncasecmp(ename, pi->s + 2, elen) : strncmp(ename, pi->s + 2, elen)) &&
|
642
643
|
'>' == *(pi->s + elen + 2)) {
|
644
|
+
|
643
645
|
/* close tag after text so treat as a value */
|
644
646
|
pi->s += elen + 3;
|
645
647
|
pi->pcb->end_element(pi, ename);
|
data/ext/ox/sax.c
CHANGED
@@ -327,7 +327,9 @@ parse(SaxDrive dr) {
|
|
327
327
|
}
|
328
328
|
c = read_doctype(dr);
|
329
329
|
} else if (0 == strncasecmp("DOCTYPE", dr->buf.str, 7)) {
|
330
|
-
|
330
|
+
if (!dr->options.smart) {
|
331
|
+
ox_sax_drive_error(dr, CASE_ERROR "expected DOCTYPE all in caps");
|
332
|
+
}
|
331
333
|
if (START_STATE != state) {
|
332
334
|
ox_sax_drive_error(dr, OUT_OF_ORDER "DOCTYPE can not come after an element");
|
333
335
|
}
|
@@ -338,7 +340,9 @@ parse(SaxDrive dr) {
|
|
338
340
|
}
|
339
341
|
c = read_cdata(dr);
|
340
342
|
} else if (0 == strncasecmp("[CDATA[", dr->buf.str, 7)) {
|
341
|
-
|
343
|
+
if (!dr->options.smart) {
|
344
|
+
ox_sax_drive_error(dr, CASE_ERROR "expected CDATA all in caps");
|
345
|
+
}
|
342
346
|
c = read_cdata(dr);
|
343
347
|
} else {
|
344
348
|
Nv parent = stack_peek(&dr->stack);
|
@@ -484,7 +488,7 @@ read_instruction(SaxDrive dr) {
|
|
484
488
|
if ('\0' == (c = read_name_token(dr))) {
|
485
489
|
return c;
|
486
490
|
}
|
487
|
-
is_xml = (0 == strcmp("xml", dr->buf.str));
|
491
|
+
is_xml = (0 == (dr->options.smart ? strcasecmp("xml", dr->buf.str) : strcmp("xml", dr->buf.str)));
|
488
492
|
if (dr->has.instruct || dr->has.end_instruct) {
|
489
493
|
target = rb_str_new2(dr->buf.str);
|
490
494
|
}
|
@@ -1000,11 +1004,11 @@ read_element_start(SaxDrive dr) {
|
|
1000
1004
|
}
|
1001
1005
|
|
1002
1006
|
static Nv
|
1003
|
-
stack_rev_find(
|
1007
|
+
stack_rev_find(SaxDrive dr, const char *name) {
|
1004
1008
|
Nv nv;
|
1005
1009
|
|
1006
|
-
for (nv = stack
|
1007
|
-
if (0 == strcmp(name, nv->name)) {
|
1010
|
+
for (nv = dr->stack.tail - 1; dr->stack.head <= nv; nv--) {
|
1011
|
+
if (0 == (dr->options.smart ? strcasecmp(name, nv->name) : strcmp(name, nv->name))) {
|
1008
1012
|
return nv;
|
1009
1013
|
}
|
1010
1014
|
}
|
@@ -1030,14 +1034,15 @@ read_element_end(SaxDrive dr) {
|
|
1030
1034
|
// c should be > and current is one past so read another char
|
1031
1035
|
c = buf_get(&dr->buf);
|
1032
1036
|
nv = stack_peek(&dr->stack);
|
1033
|
-
if (0 != nv &&
|
1037
|
+
if (0 != nv &&
|
1038
|
+
0 == (dr->options.smart ? strcasecmp(dr->buf.str, nv->name) : strcmp(dr->buf.str, nv->name))) {
|
1034
1039
|
name = nv->val;
|
1035
1040
|
h = nv->hint;
|
1036
1041
|
stack_pop(&dr->stack);
|
1037
1042
|
} else {
|
1038
1043
|
// Mismatched start and end
|
1039
1044
|
char msg[256];
|
1040
|
-
Nv match = stack_rev_find(
|
1045
|
+
Nv match = stack_rev_find(dr, dr->buf.str);
|
1041
1046
|
|
1042
1047
|
if (0 == match) {
|
1043
1048
|
// Not found so open and close element.
|
@@ -1447,6 +1452,8 @@ read_name_token(SaxDrive dr) {
|
|
1447
1452
|
break;
|
1448
1453
|
} else if ('*' == *dr->options.strip_ns && '\0' == dr->options.strip_ns[1]) {
|
1449
1454
|
dr->buf.str = dr->buf.tail;
|
1455
|
+
} else if (dr->options.smart && 0 == strncasecmp(dr->options.strip_ns, dr->buf.str, dr->buf.tail - dr->buf.str - 1)) {
|
1456
|
+
dr->buf.str = dr->buf.tail;
|
1450
1457
|
} else if (0 == strncmp(dr->options.strip_ns, dr->buf.str, dr->buf.tail - dr->buf.str - 1)) {
|
1451
1458
|
dr->buf.str = dr->buf.tail;
|
1452
1459
|
}
|
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.
|
4
|
+
version: 2.4.8
|
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: 2017-01-15 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
|
@@ -102,3 +102,4 @@ signing_key:
|
|
102
102
|
specification_version: 4
|
103
103
|
summary: A fast XML parser and object serializer.
|
104
104
|
test_files: []
|
105
|
+
has_rdoc: true
|