Skip to content

Commit 6f989c0

Browse files
committed
Try our preferred DTD first, fall back to DOCTYPE
If there it fails our validation and has no DOCTYPE or fails its DOCTYPE's, then we fail.
1 parent 6349523 commit 6f989c0

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

Changes

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
Revision history for Business-cXML
22

3+
v0.6.8 2022-07-14
4+
Enhancement: validate from default DTD for documents missing "DOCTYPE"
5+
36
v0.6.7 2018-03-27
47
Enhancement: built-in logging removes line-breaking whitespace from XML
58

69
v0.6.6 2018-02-15
710
New: debug and trace logging levels
8-
New: POSR extrinsic "UserId"
11+
New: POSR extrinsic "UserId"
912
Enhancement: trap fatal errors occuring during callbacks
1013
Bugfix: transmissions lost input payloadID since v0.6.5
1114

README

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Business-cXML v0.6.7
1+
# Business-cXML v0.6.8
22

3-
[![Build Status](https://travis-ci.org/vphantom/Business-cXML.svg?branch=v0.6.7)](https://travis-ci.org/vphantom/Business-cXML) [![Coverage Status](https://coveralls.io/repos/github/vphantom/Business-cXML/badge.svg?branch=v0.6.7)](https://coveralls.io/github/vphantom/Business-cXML?branch=v0.6.7)
3+
[![Build Status](https://travis-ci.org/vphantom/Business-cXML.svg?branch=v0.6.8)](https://travis-ci.org/vphantom/Business-cXML) [![Coverage Status](https://coveralls.io/repos/github/vphantom/Business-cXML/badge.svg?branch=v0.6.8)](https://coveralls.io/github/vphantom/Business-cXML?branch=v0.6.8)
44

55
Perl implementation of cXML messaging.
66

@@ -21,7 +21,7 @@ To install this module, run the following commands:
2121
After installing, you can find documentation for this module with the
2222
perldoc command.
2323

24-
perldoc Business::cXML
24+
perldoc Business::cXML
2525

2626
If you find any bugs, please report them at:
2727
https://github.com/vphantom/Business-cXML/issues

lib/Business/cXML.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ use Scalar::Util 'blessed';
108108
use Business::cXML::Transmission;
109109

110110
BEGIN {
111-
our $VERSION = 'v0.6.7';
111+
our $VERSION = 'v0.6.8';
112112
our $CXML_VERSION = '1.2.036';
113113
our $USERAGENT = "Business::cXML.pm $VERSION";
114114
}
@@ -575,7 +575,7 @@ sub stringify {
575575
576576
=head1 VERSION
577577
578-
0.6.7 based on cXML DTD 1.2.036
578+
0.6.8 based on cXML DTD 1.2.036
579579
580580
=head1 AUTHOR
581581

lib/Business/cXML/Transmission.pm

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,17 @@ sub new {
112112
};
113113
return [ 400, $@ ] if $@;
114114
eval {
115-
$doc->validate();
116-
$self->{xml_root} = ($doc = $doc->documentElement);
115+
my $dtd = XML::LibXML::Dtd->new(undef, "http://xml.cxml.org/schemas/cXML/" . $Business::cXML::CXML_VERSION . "/cXML.dtd");
116+
$doc->validate($dtd);
117+
};
118+
if ($@) {
119+
eval {
120+
$doc->validate();
121+
};
122+
return [ 406, $@ ] if $@;
117123
};
118-
return [ 406, $@ ] if $@;
119124

125+
$self->{xml_root} = ($doc = $doc->documentElement);
120126
$doc->ferry($self, {
121127
version => '__UNIMPLEMENTED',
122128
payloadID => '_id',

t/xml-assets/punchoutsetup2-request.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.036/cXML.dtd">
32
<cXML timestamp="2018-01-01T00:00:00-0500" payloadID="123456789.2222.55123123@localhost" xml:lang="en-US">
43
<Header>
54
<From>

0 commit comments

Comments
 (0)