-
Notifications
You must be signed in to change notification settings - Fork 99
Closed
ballerina-platform/xsd-tools
#40Labels
Description
Area
Area/Library
Description
In the data.xmldata module, when a field inside a @xmldata:SequenceGroup is typed as an array (for example, RecordValue[]), parsing XML values with parseAsType produces a false-positive error:
'RecordValue' occurs more than the maximum allowed number of times in 'sequenceGroup'.
Steps to Reproduce
Run the following sample
import ballerina/data.xmldata;
public type DataType record {|
@Sequence {minOccurs: 0, maxOccurs: 1}
SequenceGroup sequenceGroup;
|};
public type SequenceGroup record {|
@SequenceOrder {value: 1}
RecordValue[] RecordValue; // array — should allow multiple occurrences
@SequenceOrder {value: 2}
Extensions Extensions;
|};
xml data = xml `<DataType>
<RecordValue>...</RecordValue>
<RecordValue>...</RecordValue>
<Extensions>...</Extensions>
</DataType>`;
public function main() returns error? {
DataType result = check xmldata:parseAsType(data); // error thrown
}Current behaviour: An error is thrown after the second element.
Expected behaviour: Parsing should succeed, collecting all elements into the RecordValue[] array.
Version
1.6.0
Environment Details (with versions)
No response
Reactions are currently unavailable