ballerina-platform / ballerina-library

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

Generated xml from `toXml()` missing namespaces #6694

Closed prakanth97 closed 4 months ago

prakanth97 commented 4 months ago

Description:

import ballerina/data.xmldata;
import ballerina/io;

type Wsa_ReplyTo record {
    @xmldata:Namespace {prefix: "wsa", uri: "example1.com"}
    string Address;
};

type Htng_ReplyTo record {
    @xmldata:Namespace {prefix: "htng", uri: "example2.com"}
    string Address;
};

@xmldata:Name {value: "soap"}
type Soap record {
    @xmldata:Name {value: "ReplyTo"}
    @xmldata:Namespace {prefix: "wsa", uri: "example1.com"}
    Wsa_ReplyTo wsaReplyTo;
    @xmldata:Name {value: "ReplyTo"}
    @xmldata:Namespace {prefix: "htng", uri: "example2.com"}
    Htng_ReplyTo htngReplyTo;
};

public function main() returns error? {
    Soap val = {
        htngReplyTo: {
            Address: "address1"
        }, 
        wsaReplyTo: {
            Address: "address2"
        }
    };

    xml xmlVal = check xmldata:toXml(val);
    io:println(xmlVal);
}

generated output:

<soap><ReplyTo><htng:Address xmlns:htng="example2.com">address1</htng:Address></ReplyTo></soap>

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 4 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.