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

[Bug]: toString() on XML fails after adding attribute with default namespace #40373

Closed
rdulmina opened this issue May 9, 2023 · 1 comment · Fixed by #41541
Closed

[Bug]: toString() on XML fails after adding attribute with default namespace #40373

rdulmina opened this issue May 9, 2023 · 1 comment · Fixed by #41541
Assignees
Labels
Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug
Milestone

Comments

@rdulmina
Copy link
Contributor

rdulmina commented May 9, 2023

Description

import ballerina/io;

xmlns "http://sample.com/wso2/c1";

public function main() {
    xml x1 = xml `<root xmlns:ns3="http://sample.com/wso2/f"></root>`;
    var xAttr = let var x2 = <'xml:Element>x1 in x2.getAttributes();
    //adding attribute with default namespace
    xAttr["{http://sample.com/wso2/c1}foo1"] = "bar1";
    io:println(x1);
}

Gives

error: io.ballerina.runtime.internal.util.exceptions.BallerinaException {"message":"failed to get xml as string: {ballerina/lang.xml}XMLOperationError"}
        at ballerina.lang.value.0:toString(value.bal:188)
           ballerina.io.1.PrintableClassImpl:toString(print.bal:111)
           ballerina.io.1:externPrintln(print.bal:147)
           ballerina.io.1:println(print.bal:65)
           test:main(test.bal:10)

Need to enable XMLAttributesTest.testAddAttributeWithQName_5, XMLAttributesTest.testAddNamespaceAsAttribute1 after fixing this.

Affected Version(s)

No response

OS, DB, other environment details and versions

No response

Related area

-> Runtime

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

Copy link

github-actions bot commented Nov 2, 2023

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.

@HindujaB HindujaB added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Nov 13, 2023
@HindujaB HindujaB added this to the 2201.8.3 milestone Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants