I have some HTML that I need to extract as a string, but just the div and its components.
<div id=01> <div id-02> <label></labell> <input></input> //etc </div> </div>
How can I obtain every element inside of div 01 as one string?
The only other method I could find was to use the nodes, but it just gave me a list of HTMLNodes.
document.DocumentNode.SelectNodes("//*[contains(@class,'container')]").Descendants("div").Select(p => p.OuterHtml);
var Node = document.DocumentNode.SelectNodes("//div[@id='01']").SingleOrDefault(); var target = Node.InnerHtml;
because I'm single For this id, I used SingleOrDefault.