Parser ignoring IsKeepingSourceReferences
dompagoj opened this issue · 2 comments
dompagoj commented
Bug Report
Prerequisites
- Can you reproduce the problem in a MWE?
- 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?
Description
Running the parser with XmlParserOptions() { IsKeepingSourceReferences = true, } doesn't actually keep the source references, i looked into the source code and while the HtmlParser checks IsKeepingSourceReferences and assignes the source reference correctly as can be seen here
The xml parser never does that, meaning IElement.SourceReference is always null
Steps to Reproduce
- Create a XmlParser with XmlParserOptions() { IsKeepingSourceReferences = true, }
- Run Parse
**Expected behavior: IElements should have SourceReference set
**Actual behavior: SourceReference is always null
**Environment details: Linux, .NET 6
Possible Solution
Look into how the HtmlDomBuilder handles it and possibly just copy it, (don't know much about the repo so probably just ignore what i said)
FlorianRappl commented
Yeah good point - should be implemented.
FlorianRappl commented
Landed in devel
.