Description
Bug Report
Description
I cannot see anything in the document model that seems to match the values defined in the DTD nor am I seeing the DTD when performing a round-trip on the XML. I was initially investigating self-closing tags and found Issue #11 . From there, I took the example code to test with and confirm it met my need. But I noticed my DTD wasn't getting written out. As far as I can tell, the DTD isn't brought into the parsed document.
Steps to Reproduce
(Tested in LINQPad)
var xmlData = @"<?xml version=""1.0"" encoding=""UTF-8""?>
<Project Sdk=""Microsoft.NET.Sdk"">
<ItemGroup>
<PackageReference Include=""AngleSharp"" Version=""0.12.1""></PackageReference>
<PackageReference Include=""AngleSharp.Xml"" Version=""0.12.1"" />
<PackageReference Include=""AngleSharp.XPath"" Version=""1.1.4"" />
</ItemGroup>
</Project>";
var xmlDoc = new XmlParser().ParseDocument(xmlData);
using (var sw = new StringWriter())
{
xmlDoc.ToHtml(sw, xmlFormatter);
Console.WriteLine(sw.ToString());
}
Expected behavior: [What you expected to happen]
Output to look similar to
<?xml version="1.0" encoding="UTF-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="AngleSharp" Version="0.12.1" />
<PackageReference Include="AngleSharp.Xml" Version="0.12.1" />
<PackageReference Include="AngleSharp.XPath" Version="1.1.4" />
</ItemGroup>
</Project>
Actual behavior: [What actually happened]
Output is
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="AngleSharp" Version="0.12.1" />
<PackageReference Include="AngleSharp.Xml" Version="0.12.1" />
<PackageReference Include="AngleSharp.XPath" Version="1.1.4" />
</ItemGroup>
</Project>
Environment details: [OS, .NET Runtime, ...]
Windows 10
LINQPad 7
AngleSharp 1.0.5 via NuGet
AngleSharp.Xml 1.0.0 via NuGet
Possible Solution
Am I missing some options/techniques to force the correct parse?