As per the issue, an incomplete xmlns definition in a comment could break the XML parsing as it would result in an invalid XML document being produced as a result of the escaping.
This change modifies the XML escaping code to allow for such comments to not break the parsing process.
Additionally, this PR adds tests to verify that the XML escaping (& unescaping) code does not cause any issues. This part of the code previously had no test coverage. These tests use all the sample files currently included in the test project for other test cases. I, therefore, assume this to be a comprehensive collection of file scenarios. (A brief look at the files shows they cover a lot!)
Admittedly, the reported issue is a remote edge case, and so it's probably not a high-priority fix. However, as this PR increases test coverage hopefully makes it a beneficial update.
Checklist:
[x] I have commented my code, particularly in hard-to-understand areas
[x] My changes generate no new warnings
[x] I have added tests that prove my fix is effective or that my feature works
[x] New and existing unit tests pass locally with my changes
[ ] I have tested my changes by running the extension in VS2017
[x] I have tested my changes by running the extension in VS2019
[x] I have tested my changes by running the extension in VS2022
[ ] If changes to the documentation are needed, I have noted this in the description above
Description:
Fixes #426 (issue)
As per the issue, an incomplete xmlns definition in a comment could break the XML parsing as it would result in an invalid XML document being produced as a result of the escaping.
This change modifies the XML escaping code to allow for such comments to not break the parsing process.
Additionally, this PR adds tests to verify that the XML escaping (& unescaping) code does not cause any issues. This part of the code previously had no test coverage. These tests use all the sample files currently included in the test project for other test cases. I, therefore, assume this to be a comprehensive collection of file scenarios. (A brief look at the files shows they cover a lot!)
Admittedly, the reported issue is a remote edge case, and so it's probably not a high-priority fix. However, as this PR increases test coverage hopefully makes it a beneficial update.
Checklist: