XML decoding error
Submitted by G??bor Szalai
Link to original bug (#570707)
Description
The compact form of the XML document can't be decoded:
module proba{
external function encode_PDU(in X1Response pdu) return octetstring with { extension "prototype(convert) encode(XER:XER_EXTENDED) printing(compact)" } external function decode_PDU(in octetstring os) return X1Response with { extension "prototype(convert) decode(XER:XER_EXTENDED)" }
type universal charstring XMLCompatibleString ( char(0,0,0,9)..char(0,0,0,9), char(0,0,0,10)..char(0,0,0,10), char(0,0,0,13)..char(0,0,0,13), char(0,0,0,32)..char(0,0,215,255), char(0,0,224,0)..char(0,0,255,253), char(0,1,0,0)..char(0,16,255,253) )
type XMLCompatibleString String with { variant "XSD:string"; };
type record CDResponse { String aIdentifier, String nIdentifier, String messageTimestamp
};
type record RTResponse { String nIdentifier, String messageTimestamp };
type ResponseContainer X1Response with { variant "element"; };
type record ResponseContainer { record length(1 .. infinity) of ResponseMessage x1ResponseMessage_list } with { variant (x1ResponseMessage_list) "untagged"; variant (x1ResponseMessage_list[-]) "name as 'x1ResponseMessage'"; };
type union ResponseMessage { CDResponse cDResponse, RTResponse rTResponse } with { variant "useType"; variant (cDResponse) "name as capitalized"; variant (rTResponse) "name as capitalized"; };
type component CT {}
testcase TC() runs on CT{ var octetstring oct var X1Response resp
resp:={ {{ cDResponse:={ aIdentifier:= "aIdentifier", nIdentifier:= "nIdentifier", messageTimestamp := "messageTimestamp" } }} } oct:=encode_PDU(resp) log(oct) // If the \n added the XML document can be decoded. // oct:=char2oct("<ns1:X1Response xmlns:ns1='http://uri.etsi.org/03221/X1/2017/10'>ns1:x1ResponseMessage\nns1:aIdentifieraIdentifier</ns1:aIdentifier>ns1:nIdentifiernIdentifier</ns1:nIdentifier>ns1:messageTimestampmessageTimestamp</ns1:messageTimestamp></ns1:x1ResponseMessage></ns1:X1Response>\n") resp:=decode_PDU(oct) // DTE log(resp)
}
control { execute(TC()) }
} with { encode "XML"; variant "namespace as 'http://uri.etsi.org/03221/X1/2017/10' prefix 'ns1'"; variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'"; variant "elementFormQualified"; }
Version: 7.1.0