HtmlParsingHelper.TryExtractTagContent Method
- Namespace
- Kampute.DocToolkit.Support
- Assembly
- Kampute.DocToolkit.dll
Definition
Attempts to extract the content between opening and closing tags with the specified name.
public static bool TryExtractTagContent(string html, string tagName, [NotNullWhen(true)] out string content)Parameters
htmlstring- The HTML content to search.
tagNamestring- The name of the tag to search for.
contentstring- When this method returns, contains the content between the tags, if found; otherwise,
null. This parameter is passed uninitialized.
Returns
Remarks
The content is taken from the first opening tag up to its matching closing tag, so nested elements with the same tag name are part of the content. Tag-like text in comments, quoted attributes, and raw text elements is not treated as markup.
