import ballerina/data.xmldata;
import ballerina/test;
xml x2 = xml `<A a1="2024" a2="3.14">Sample Text</A>`;
type A23 record {string \#content; int|decimal a1;};
public function main() {
A23|error a23 = xmldata:parseAsType(x2);
test:assertEquals(a23, {"#content":"Sample Text","a1":2024, "a2": <decimal>3.14}); // assertion failed
}
The current output of the above code is {"#content":"Sample Text","a1":2024}
But the correct output should be {"#content":"Sample Text","a1":2024,"a2":3.14}
code
The current output of the above code is
{"#content":"Sample Text","a1":2024}
But the correct output should be{"#content":"Sample Text","a1":2024,"a2":3.14}