Skip to content

[Bug]: xml:fromString() fails to parse valid XML with declaration — throws “Illegal processing instruction target ('xml')” #44363

@chiranSachintha

Description

@chiranSachintha

Description

When trying to parse a valid XML string that includes an XML declaration using xml:fromString(), the function throws an error even though the XML content is valid.

Steps to Reproduce

public function main() returns error? {
    string body = string `<?xml version="1.1" encoding="UTF8"?><A><B>123</B></A>`;
    xml val = check xml:fromString(body);
}

The XML declaration is valid as per the XML specification.
xml:fromString() should successfully parse this string and produce the corresponding XML object.

Affected Version(s)

12.10

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions