HtmlNodeProperty
Retrieves one of select properties of an HTML Node
- Free Function
- SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017
SELECT SQLHTTP.net.HTMLNodeProperty ( @HtmlNode, @Property )
Name | Type | Description |
---|---|---|
@HtmlNode | nvarchar(MAX) | String composed of an HTML node |
@Property | varchar(50) | One of the following values: Closed, EndNode, HasAttributes, HasChildNodes, ID, InnerHtml, InnerText, Name, NodeType |
nvarchar(MAX)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
DECLARE @HtmlNode nvarchar(MAX) SET @HtmlNode = '<div> <img src="image.png" alt="Logo"> <span>Sample Text</span> </div>' SELECT SQLHTTP.net.HtmlNodeProperty(@HtmlNode, 'Closed') AS Closed, SQLHTTP.net.HtmlNodeProperty(@HtmlNode, 'EndNode') AS EndNode, SQLHTTP.net.HtmlNodeProperty(@HtmlNode, 'HasAttributes') AS HasAttributes, SQLHTTP.net.HtmlNodeProperty(@HtmlNode, 'HasChildNodes') AS HasChildNodes, SQLHTTP.net.HtmlNodeProperty(@HtmlNode, 'InnerText') AS InnerText, SQLHTTP.net.HtmlNodeProperty(@HtmlNode, 'Name') AS Name, SQLHTTP.net.HtmlNodeProperty(@HtmlNode, 'NodeType') AS NodeType |
1 2 3 4 5 |
Closed EndNode HasAttributes HasChildNodes InnerText Name NodeType ------- --------- -------------- -------------- --------------- ------- ------------- True </div> False True Sample Text div Element |