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

Fix xml toString() error for modified name space attributes #41541

Merged
merged 11 commits into from
Nov 2, 2023

Conversation

HindujaB
Copy link
Contributor

@HindujaB HindujaB commented Oct 19, 2023

Purpose

$subject

Fixes #40373
Fixes #41521

Approach

  • Fix checking 'xmlns` as the default NS key when writing XML value with default namespace attributes.
  • Fixed wrong class casting for whitespace values at the start of the XML query
  • Removed disableOnOldParser test group as it is no-longer used

Samples

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);
}

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@rdulmina
Copy link
Contributor

Needs to enable XMLAttributesTest.testAddAttributeWithQName_5, XMLAttributesTest.testAddNamespaceAsAttribute1 tests

@codecov
Copy link

codecov bot commented Oct 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b20eaf9) 76.69% compared to head (426f1ac) 76.70%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #41541   +/-   ##
=========================================
  Coverage     76.69%   76.70%           
  Complexity    52669    52669           
=========================================
  Files          2881     2881           
  Lines        198537   198537           
  Branches      25812    25812           
=========================================
+ Hits         152273   152279    +6     
+ Misses        37832    37825    -7     
- Partials       8432     8433    +1     
Files Coverage Δ
...erina/runtime/internal/BallerinaXmlSerializer.java 79.24% <100.00%> (-0.95%) ⬇️
.../io/ballerina/runtime/internal/values/XmlItem.java 59.60% <100.00%> (+3.92%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Nadeeshan96 Nadeeshan96 added the Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime label Oct 23, 2023
Copy link
Contributor

@warunalakshitha warunalakshitha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rdulmina
Copy link
Contributor

rdulmina commented Nov 2, 2023

Let's send this to 8.x as well

@warunalakshitha warunalakshitha merged commit e57be43 into ballerina-platform:master Nov 2, 2023
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime
Projects
None yet
4 participants