2
我正在使用AngleSharp并希望知道如何将HTML部分转换为SVG,XML或其他自定义支架支持的格式。如何构建自定义AngleSharp元素并将HTML部分插入/转换到元素中
问题:如何构建自定义AngleSharp IElement,然后转换自定义元素内部的div(或链接)内容,即采用我找到的div /链接,然后将div内容放入自定义元素中
下面是我想
var divToTransform = document.QuerySelector("div.class1.class2");
// need a custom transform, something simple like replacing the tags
new IElement myCustomeAngleBracketQml = new CustomeAngleBracketQml(divToTransform);
//something simple like replacing the tags
myCustomeAngleBracketQml.Replace("div", Tag).With("QmlDiv");
//insert the content
myCustomeAngleBracketQml.TextContent = divToTransform.innerContent();
//1) how to put this back in the place of the original div, after deleting that div?
///2) *how to target a specific node in the Dom
document./*after Div with class, or Div with Id*/.AppendChild(element);
感谢
代码
喜,而这是伟大的,我一用[AngleSharp(https://github.com/AngleSharp/)LIB(顺便说一句 - 将你的代码片段的交换与我的自定义标签的div标签) – transformer
是的,你可以将我的代码添加到使用linq枚举循环。 – jdweng