diff --git a/THIRDPARTYNOTICES.md b/THIRDPARTYNOTICES.md index 14a1dc4437..369c50e818 100644 --- a/THIRDPARTYNOTICES.md +++ b/THIRDPARTYNOTICES.md @@ -4,12 +4,12 @@ Do Not Translate or Localize This file is based on or incorporates material from the projects listed below (Third Party IP). The original copyright notice and the license under which Microsoft received such Third Party IP, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft licenses the Third Party IP to you under the licensing terms for the Microsoft product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise. -## AngleSharp 0.9.11 +## AngleSharp 0.11.0 * Component Source: https://github.com/AngleSharp/AngleSharp/ * Component Copyright and License: > The MIT License (MIT) > - > Copyright (c) 2013 - 2018 AngleSharp + > Copyright (c) 2013 - 2019 AngleSharp > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal diff --git a/src/Microsoft.Health.Fhir.Core/Features/Validation/Narratives/NarrativeHtmlSanitizer.cs b/src/Microsoft.Health.Fhir.Core/Features/Validation/Narratives/NarrativeHtmlSanitizer.cs index 96cf78d50d..0d5d562ec7 100644 --- a/src/Microsoft.Health.Fhir.Core/Features/Validation/Narratives/NarrativeHtmlSanitizer.cs +++ b/src/Microsoft.Health.Fhir.Core/Features/Validation/Narratives/NarrativeHtmlSanitizer.cs @@ -8,11 +8,10 @@ using System.Linq; using AngleSharp; using AngleSharp.Dom; -using AngleSharp.Dom.Events; -using AngleSharp.Dom.Html; -using AngleSharp.Extensions; using AngleSharp.Html; -using AngleSharp.Parser.Html; +using AngleSharp.Html.Dom; +using AngleSharp.Html.Dom.Events; +using AngleSharp.Html.Parser; using EnsureThat; using Microsoft.Extensions.Logging; @@ -173,12 +172,11 @@ public IEnumerable Validate(string html) { var errors = new List(); var options = new HtmlParserOptions { IsStrictMode = false }; - var context = BrowsingContext.New(Configuration.Default); - context.ParseError += (sender, error) => errors.Add((HtmlErrorEvent)error); + var parser = new HtmlParser(options); - var parser = new HtmlParser(options, context); + parser.Error += (sender, error) => errors.Add((HtmlErrorEvent)error); - var dom = parser.ParseFragment(string.Format(HtmlTemplate, html), null); + var dom = parser.ParseDocument(string.Format(HtmlTemplate, html)); // Report parsing errors if (errors.Any()) @@ -191,7 +189,7 @@ public IEnumerable Validate(string html) yield break; } - var htmlBodyElement = dom.OfType().FirstOrDefault() + var htmlBodyElement = dom.Children.OfType().FirstOrDefault() ?.Children.OfType().FirstOrDefault(); // According to https://www.hl7.org/fhir/narrative.html @@ -239,7 +237,7 @@ public string Sanitize(string html) { var parser = new HtmlParser(); - using (var dom = parser.Parse(string.Format(HtmlTemplate, html))) + using (var dom = parser.ParseDocument(string.Format(HtmlTemplate, html))) { var containerDiv = dom.Body.Children.OfType().FirstOrDefault(); if (containerDiv == null) diff --git a/src/Microsoft.Health.Fhir.Core/Microsoft.Health.Fhir.Core.csproj b/src/Microsoft.Health.Fhir.Core/Microsoft.Health.Fhir.Core.csproj index 8797f44024..3303448fa3 100644 --- a/src/Microsoft.Health.Fhir.Core/Microsoft.Health.Fhir.Core.csproj +++ b/src/Microsoft.Health.Fhir.Core/Microsoft.Health.Fhir.Core.csproj @@ -18,7 +18,7 @@ - +