Skip to content

XmlParser InnerHtml property not working #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Wojdav opened this issue Nov 15, 2016 · 5 comments
Closed

XmlParser InnerHtml property not working #1

Wojdav opened this issue Nov 15, 2016 · 5 comments
Labels
enhancement New feature or request

Comments

@Wojdav
Copy link

Wojdav commented Nov 15, 2016

when i have used innerHtml property on xmlElement i didn't have any results.

exmple code

var xmlParser = new XmlParser();
var xmlDocument = xmlParser.Parse("<div></div>");
var querySelector = xmlDocument.QuerySelector("div");

querySelector.InnerHtml = "<a></a>";

TestContext.WriteLine(xmlDocument.ToHtml());

result <div></div>

@FlorianRappl
Copy link
Contributor

The InnerHtml property is related to HTML; while serializing still works the fragment parsing mode is only defined for HTML. Same holds true for, e.g., OuterHtml.

I'll see if this can be improved.

@Wojdav
Copy link
Author

Wojdav commented Nov 15, 2016

CreateForeignElementFrom method (htmlDomBuilder.cs, 3423 line) returns null. This is the problem.

Best Regards

@FlorianRappl
Copy link
Contributor

FlorianRappl commented Nov 15, 2016

Nope, this is not the problem. The problem is that this is not defined for XML (thus the HTML DOM Builder should not be used). Please do not confuse XML with HTML or vice versa.

FlorianRappl referenced this issue in FlorianRappl/AngleSharp Nov 28, 2016
@FlorianRappl
Copy link
Contributor

Right now I think it can't be done efficiently. The DocumentFragment always assumes to be in an HTML environment, however, as ParseFragment is/was not defined for XML (in AngleSharp) I don't see how we can support both in an elegant and robust way.

I will implement a solution for v1!

@FlorianRappl FlorianRappl transferred this issue from AngleSharp/AngleSharp Jan 7, 2019
@FlorianRappl FlorianRappl added the enhancement New feature or request label May 1, 2019
@FlorianRappl
Copy link
Contributor

Landed in devel - scheduled for next release.

FlorianRappl added a commit that referenced this issue May 1, 2019
FlorianRappl added a commit that referenced this issue Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants