You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[✓] Are you running the latest version of AngleSharp?
[✓] Did you check the FAQs to see if that helps you?
[✓] Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Css for CSS support)
[✓] Did you perform a search in the issues?
For more information, see the CONTRIBUTING guide.
Description
When using IsSuppressingErrors = true in XmlParserOptions an exception is thrown when trying to parse an invalid XML.
The Stacktrace:
AngleSharp.Xml.Parser.XmlParseException: Error while parsing the provided XML document.
at AngleSharp.Xml.Parser.XmlTokenizer.TagSelfClosing(XmlTagToken tag)
at AngleSharp.Xml.Parser.XmlDomBuilder.ParseAsync(XmlParserOptions options, CancellationToken cancelToken)
at AngleSharp.Xml.Parser.XmlParser.ParseAsync(XmlDocument document, CancellationToken cancel)
The problem is the missing closing tag of the first <P>.
When parsing the xml like so, the exception from the description above is thrown:
varxml="xml from above";varconfig=Configuration.Default.WithXml();varcontext=BrowsingContext.New(config);varparser=newXmlParser(newXmlParserOptions{IsSuppressingErrors=true},context);vardocument=awaitparser.ParseDocumentAsync(xml,cancellationToken);varhtml=document.ToHtml();
I know this sounds quite stupid, but I need to actually parse invalid XML data and convert it to HTML afterwards.
Is there some way to parse and/or fix an invalid XML with AngleSharp.Xml?
The text was updated successfully, but these errors were encountered:
As of writing maybe it is not the <P> tag, but the wierd <https://some.url.example.com>. I'll check this and come back here again
cmxl
changed the title
Missing closing Tag should not break parsing when IsSuppressingErrors = true
Invalid XML should not break parsing when IsSuppressingErrors = true
Apr 7, 2021
Bug Report
Prerequisites
AngleSharp.Css
for CSS support)For more information, see the
CONTRIBUTING
guide.Description
When using
IsSuppressingErrors = true
in XmlParserOptions an exception is thrown when trying to parse an invalid XML.The Stacktrace:
Steps to Reproduce
Given the following XML:
The problem is the missing closing tag of the first
<P>
.When parsing the xml like so, the exception from the description above is thrown:
I know this sounds quite stupid, but I need to actually parse invalid XML data and convert it to HTML afterwards.
Is there some way to parse and/or fix an invalid XML with AngleSharp.Xml?
The text was updated successfully, but these errors were encountered: