ballerina-platform / ballerina-spec

Ballerina Language and Platform Specifications
Other
167 stars 53 forks source link

Handling XML Doctype defintions in xml templates #1293

Closed poorna2152 closed 2 months ago

poorna2152 commented 8 months ago

Description: When xml Doctype node is present in a xml template in the ballerina code, currently the compiler gives a parser error. Is this a valid scenario to have DocType node in an xml template. If it is a valid scenario, how are we going to model it in the implementation

Example code,

public function main() {
    xml _ = xml `<!DOCTYPE note [
            <!ELEMENT note (to,from,heading,body)>
            <!ELEMENT to (#PCDATA)>
            <!ELEMENT from (#PCDATA)>
            <!ELEMENT heading (#PCDATA)>
            <!ELEMENT body (#PCDATA)>
        ]>
        <note>
            <to>Tove</to>
            <from>Jani</from>
            <heading>Reminder</heading>
            <body>Don't forget me this weekend</body>
        </note>`;
}
jclark commented 2 months ago

Not allowed because spec https://ballerina.io/spec/lang/2024R1/#section_6.6.2 says it is parsed as XML content https://www.w3.org/TR/xml/#dt-content