647b2b0f37
- Added `AnchorDataProvider`, `AnchorCollectionDataProvider`, `ContentsDataProvider`, `ContentsArrayDataProvider`, `DropDownDataProvider`, `ListContentDataProvider`, and `ParagraphedContentDataProvider` for enhanced data extraction flexibility. - Updated project version to 2.5.0.
31 lines
769 B
C#
31 lines
769 B
C#
using HtmlAgilityPack;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Beam.Abstractions;
|
|
|
|
namespace Beam.Dynamic {
|
|
public class ContentsDataProvider : IComposableDataProvider<string> {
|
|
public IBinding? Content { get; set; }
|
|
|
|
public string Get(HtmlDocument document) {
|
|
var node = Select(document);
|
|
return node is null ? "" : Get(node);
|
|
}
|
|
|
|
public string Get(HtmlNode node) {
|
|
return node.InnerText;
|
|
}
|
|
public HtmlNode? Select(HtmlDocument doc) {
|
|
return Content?.Select(doc);
|
|
}
|
|
|
|
public HtmlNode? Select(HtmlNode node) {
|
|
return node;
|
|
}
|
|
}
|
|
}
|