This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support XmlKnownDtds in XmlPreloadedResolver (#36971)
* Support XmlKnownDtds in XmlPreloadedResolver The XmlPreloadedResolver class purports to provide certain well-known DTDs - its constructor accepts a value from the XmlKnownDtds enumeration, and if you specify either of the supported DTD sets (sXHTML 1.0, and RSS 0.91) it is meant to make the relevant DTDs available. In desktop .NET, this works as advertised. In .NET Core, it does not, for the reasons described in https://github.com/dotnet/corefx/issues/36929 This was missed because there are no tests to verify that the XmlPreloadedResolver makes the relevant DTDs available when asked to. (In fact, the tests that existed seemed to be based on a misunderstanding of how this class works.) This adds tests that verify that the known DTDs are provided when requested. And it reinstates the relevant EmbeddedResource entries required to enable the functionality. (The code for this has been in .NET Core's XmlPreloadedResolver all along. It was only the absence of the necessary embedded resources preventing it from working.) * Completed refactoring that was half-complete In the previous commit I introduced the NormalizeContent method to avoid duplication of various calls to string.Replace but I left in one such call. This replaces it with a call to the new NormalizeContent, as intended. * Replace \ with / in test paths Tests failed on Linux with this: Could not find a part of the path '/root/helix/work/workitem/Utils\\DTDs\\/XHTML10\ I'm hoping that replacing the backslashes with forward slashes will get the tests passing. * Replaced fixed / and \ with Path.Combine Although using / everywhere did seem to work, the preferred way to generate paths is Path.Combine. Note that this still uses string concatenation for the system ID URI because that's not a path, it's just an identifier.
- Loading branch information
Showing
3 changed files
with
118 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters