ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
137 stars 58 forks source link

Compilation Error for XML with Duplicate Field and Attribute Names #6705

Closed AzeemMuzammil closed 2 months ago

AzeemMuzammil commented 2 months ago

Description: An issue arises when parsing XML where an element and an attribute share the same name. The corresponding record in the Ballerina language fails to compile, demonstrating an inconsistency or bug in handling XML attributes versus elements. Below is an example illustrating the issue:

XML

<RecType field="attribute">
    <field>text</field>
</RecType>

Relevant Record

type RecType record {
    string field;
    @xmldata:Name {
        value: "field"
    }
    @xmldata:Attribute
    string duplicateField;
};

Note: The above record gives compilation error, where it should not be giving.

Steps to reproduce:

Affected Versions:

OS, DB, other environment details and versions:

Related Issues (optional):

Suggested Labels (optional):

Suggested Assignees (optional):

github-actions[bot] commented 2 months ago

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.