Skip to content

Commit fd2f794

Browse files
authored
Merge pull request #2289 from skendrot/JsonNetParsers
Remove Json.NET from Parsers library
2 parents a69c60a + 4801a9c commit fd2f794

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

Microsoft.Toolkit.Parsers/Markdown/Inlines/LinkAnchorInline.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System.Collections.Generic;
6-
using System.Xml;
6+
using System.Xml.Linq;
77
using Microsoft.Toolkit.Parsers.Markdown.Helpers;
88

99
namespace Microsoft.Toolkit.Parsers.Markdown.Inlines
@@ -85,10 +85,12 @@ internal static InlineParseResult Parse(string markdown, int start, int maxEnd)
8585

8686
try
8787
{
88-
var xml = new XmlDocument();
89-
xml.LoadXml(contents);
90-
var attr = xml.DocumentElement.Attributes.GetNamedItem("name");
91-
link = attr.Value;
88+
var xml = XElement.Parse(contents);
89+
var attr = xml.Attribute("name");
90+
if (attr != null)
91+
{
92+
link = attr.Value;
93+
}
9294
}
9395
catch
9496
{

Microsoft.Toolkit.Parsers/Microsoft.Toolkit.Parsers.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
<DebugType>Full</DebugType>
1111
</PropertyGroup>
1212

13-
<ItemGroup>
14-
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
15-
</ItemGroup>
16-
1713
<ItemGroup>
1814
<ProjectReference Include="..\Microsoft.Toolkit\Microsoft.Toolkit.csproj" />
1915
</ItemGroup>

0 commit comments

Comments
 (0)