import ballerina/data.xmldata;
import ballerina/io;
public function main() {
string xmlValue = string `
<User>
<id>1</id>
<age>23</age>
<nestedXml>
<id>1</id>
<age>23</age>
</nestedXml>
</User>`;
record {
int id;
int age;
record {
int id;
int age;
} nestedXml;
}|xmldata:Error user = xmldata:parseString(xmlValue);
io:println(user);
}
The above code gives error Error ("required field 'age' not present in XML").
This error message incorrect since, is present in the XML.
This issue happens since outer and inner element both have same element name <age>.
Description
Code
The above code gives is present in the XML.
error Error ("required field 'age' not present in XML")
. This error message incorrect since,This issue happens since outer and inner element both have same element name
<age>
.Steps to Reproduce
$Description
Version
2201.10.2
Environment Details (with versions)
No response