Skip to content

Commit 85e44a1

Browse files
committed
Supress syntax exceptions
1 parent ce5bc1c commit 85e44a1

File tree

8 files changed

+466
-86
lines changed

8 files changed

+466
-86
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 0.15.0
2+
3+
Released on Thursday, April 22 2021.
4+
5+
- Dropped support for .NET Standard 1.3 target
6+
- Fixed breaking parsing upon invalid syntax when suppressing errors (#14)
7+
18
# 0.14.0
29

310
Released on Tuesday, March 31 2020.

build.cake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ var frameworks = new Dictionary<String, String>
66
{ "net46", "net46" },
77
{ "net461", "net461" },
88
{ "net472", "net472" },
9-
{ "netstandard1.3", "netstandard1.3" },
109
{ "netstandard2.0", "netstandard2.0" },
1110
};
1211

src/AngleSharp.Xml.Tests/AngleSharp.Xml.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<ItemGroup>
1818
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
19-
<PackageReference Include="AngleSharp" Version="0.14.0" />
19+
<PackageReference Include="AngleSharp" Version="0.15.0" />
2020
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
2121
<PackageReference Include="NUnit" Version="3.13.1" />
2222
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />

src/AngleSharp.Xml.Tests/Parser/XmlParsing.cs

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace AngleSharp.Xml.Tests.Parser
22
{
33
using AngleSharp.Xml.Parser;
44
using NUnit.Framework;
5+
using System;
56

67
[TestFixture]
78
public class XmlParsing
@@ -71,5 +72,79 @@ public void ParseInvalidXmlEntityShouldBeSerialized()
7172
var document = parser.ParseDocument(source);
7273
Assert.AreEqual("&nbsp;", document.DocumentElement.TextContent);
7374
}
75+
76+
[Test]
77+
public void ParseInvalidXmlShouldThrowWhenNotSuppressingErrors_Issue14()
78+
{
79+
Assert.Throws<XmlParseException>(() =>
80+
{
81+
var source = @"<P>
82+
<P>
83+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000""></FONT>
84+
</P>
85+
<P>
86+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000""></FONT>
87+
</P>
88+
<P>
89+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#0000ff"">
90+
<U>
91+
<https://some.url.example.com></U>
92+
</FONT>
93+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000"">
94+
<B></B>
95+
</FONT>
96+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000""></FONT>
97+
</P>
98+
<P>
99+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000""></FONT>
100+
</P>
101+
<P>
102+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000""></FONT>
103+
</P>
104+
</P>";
105+
var parser = new XmlParser(new XmlParserOptions
106+
{
107+
IsSuppressingErrors = false
108+
});
109+
parser.ParseDocument(source);
110+
});
111+
}
112+
113+
[Test]
114+
public void ParseInvalidXmlShouldNotThrowWhenSuppressingErrors_Issue14()
115+
{
116+
Assert.DoesNotThrow(() =>
117+
{
118+
var source = @"<P>
119+
<P>
120+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000""></FONT>
121+
</P>
122+
<P>
123+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000""></FONT>
124+
</P>
125+
<P>
126+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#0000ff"">
127+
<U>
128+
<https://some.url.example.com></U>
129+
</FONT>
130+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000"">
131+
<B></B>
132+
</FONT>
133+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000""></FONT>
134+
</P>
135+
<P>
136+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000""></FONT>
137+
</P>
138+
<P>
139+
<FONT FACE=""calibri"" SIZE=""14.666666666666666"" COLOR=""#000000""></FONT>
140+
</P>
141+
</P>";
142+
var parser = new XmlParser(new XmlParserOptions
143+
{
144+
IsSuppressingErrors = true
145+
});
146+
parser.ParseDocument(source);
147+
});
148+
}
74149
}
75150
}

src/AngleSharp.Xml.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<copyright>Copyright 2016-2021, AngleSharp</copyright>
1515
<tags>html html5 css css3 dom requester http https xml dtd</tags>
1616
<dependencies>
17-
<dependency id="AngleSharp" version="0.14.0" />
17+
<dependency id="AngleSharp" version="0.15.0" />
1818
</dependencies>
1919
</metadata>
2020
</package>

src/AngleSharp.Xml/AngleSharp.Xml.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</ItemGroup>
2222

2323
<ItemGroup>
24-
<PackageReference Include="AngleSharp" Version="0.14.0" />
24+
<PackageReference Include="AngleSharp" Version="0.15.0" />
2525
</ItemGroup>
2626

2727
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">

0 commit comments

Comments
 (0)