Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing namespace information in generated XML for inferred record types #7402

Open
Nuvindu opened this issue Nov 22, 2024 · 0 comments
Open

Comments

@Nuvindu
Copy link
Contributor

Nuvindu commented Nov 22, 2024

Description

When converting a record type annotated with @xmldata:Namespace to XML using the xmldata:toXml() function, the generated XML does not include the namespace information specified in the annotations. Additionally the root type (<Body> tag) is also missing in the result.

Steps to Reproduce

  1. Run the following sample code
import ballerina/data.xmldata;
import ballerina/io;

@xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"}
public type SoapBody Body;

@xmldata:Namespace {prefix: "xs2", uri: "http://www.w3.org/2001/XMLSchema2"}
public type Body record {
    @xmldata:Namespace {prefix: "xs1", uri: "http://www.w3.org/2001/XMLSchema1"}
    string value;
};

public function main() returns error? {
    SoapBody document = {
        value: "this is a string"
    };
    xml xmlDocument = check xmldata:toXml(document);
    io:println(xmlDocument);
}

Result:
<value>this is a string</value>

Expected Result:
<soap:SoapBody xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><xs1:value xmlns:xs1="http://www.w3.org/2001/XMLSchema1">this is a string</xs1:value></soap:SoapBody>

Version

2201.10.2

Environment Details (with versions)

No response

@Nuvindu Nuvindu changed the title Namespace information missing in generated XML for inferred record types Missing namespace information in generated XML for inferred record types Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: BackLog
Development

No branches or pull requests

1 participant