Skip to content

Issue when XML contains Processing Instruction , but no Declaration #292

Open
@ashwinss3

Description

@ashwinss3

When an XML file starts like this:

<?xml-stylesheet type='text/xsl' href='https://zzz.xsl' alternate='no' title='Default'?>
<rootTag>
      <tag1>
      <tag2>

since there is no xml declaration, it gives a warning:

:1:6: whitespace expectedstylesheet type='text/xsl' href='https://zzz.xsl' alternate='no' title='Default'?>     ^
:1:6: '?' expected instead of '-'<rootTag xmlns="something" xmlns:xsi="http://www.w3.org/something">     ^
:1:6: '>' expected instead of '-'	<tag1 code="QQ" />     ^

And then it processes normally as if tag2 is the first tag. It does not give any error, but parse the file wrongly. If an xml declaration is added it works fine:

<?xml version = "1.0" ?>
<?xml-stylesheet type='text/xsl' href='https://zzz.xsl' alternate='no' title='Default'?>
<rootTag>
      <tag1>
      <tag2>

Shouldn't it be giving an error, if xml declaration was the issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions