Closed Seralahthan closed 6 years ago
Hi @Seralahthan,
XML Literal (xml some content
) only allows parsing a single xml item (a single element, text, comment or a processing instruction). However, in soapResp1 contains two items within the literal. That's why it fails.
The solution is to define them separately and concat them as below.
xml docType = xml `<?xml version="1.0" encoding="UTF-8"?>` ;
xml soapPayload = xml `<ns:getQuoteResponse xmlns:ns="http://services.samples">
<ns:return xmlns:ax21="http://services.samples/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax21:GetQuoteResponse">
<ax21:change>3.8023739781944386</ax21:change>
<ax21:earnings>-9.58706726808414</ax21:earnings>
<ax21:high>90.1204744818775</ax21:high>
<ax21:last>87.00770771274415</ax21:last>
<ax21:lastTradeTimestamp>Wed Jan 10 10:17:04 IST 2018</ax21:lastTradeTimestamp>
<ax21:low>89.96298980939689</ax21:low>
<ax21:marketCap>5.349140522956562E7</ax21:marketCap>
<ax21:name>WSO2 Company</ax21:name>
<ax21:open>-85.85962074870565</ax21:open>
<ax21:peRatio>-19.963567651822213</ax21:peRatio>
<ax21:percentageChange>3.867313309537189</ax21:percentageChange>
<ax21:prevClose>98.32081535306169</ax21:prevClose>
<ax21:symbol>WSO2</ax21:symbol>
<ax21:volume>16449</ax21:volume>
</ns:return>
</ns:getQuoteResponse>`;
xml finalXml = docType + soapPayload;
Solution shared, hence closing the issue.
Description: Getting a ballerina build failure with
ballerina-internal.log files have the following ballerina exception thrown by the compiler.
ERROR {org.ballerinalang.launcher.Main} - error : compilation failed org.ballerinalang.util.exceptions.BallerinaException: error : compilation failed at org.ballerinalang.testerina.core.BTestRunner.lambda$compileAndBuildSuites$7(BTestRunner.java:175) at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at org.ballerinalang.testerina.core.BTestRunner.compileAndBuildSuites(BTestRunner.java:155) at org.ballerinalang.testerina.core.BTestRunner.runTest(BTestRunner.java:97) at org.ballerinalang.testerina.core.BTestRunner.runTest(BTestRunner.java:82) at org.ballerinalang.testerina.core.BTestRunner.runTest(BTestRunner.java:71) at org.ballerinalang.testerina.core.TestCmd.execute(TestCmd.java:160) at java.util.Optional.ifPresent(Optional.java:159) at org.ballerinalang.launcher.Main.main(Main.java:66)
Steps to reproduce: Run the following lines using 0.980.1
}`
Affected Versions: Running the code on Ballerina-0.980.1. VS Code Plugin 0.980.1.vsix
OS, DB, other environment details and versions: Ubuntu:16.04
Related Issues (optional):
Suggested Labels (optional):
Suggested Assignees (optional):