Html_To_Xml
Converts an HTML string to XML
- Free Function
- SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017
SELECT SQLHTTP.net.Html_To_Xml ( @Html )
Name | Type | Description |
---|---|---|
@Html | nvarchar(MAX) | An HTML string |
xml
Note that an HTML does not require a closing for the certain tags, but XML does.
In this example converting the Html to Xml results in a closing tag for the tag:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
DECLARE @Html nvarchar(MAX) SET @Html = N'<html> <head> <title>Sample Page</title> </head> <body> <img src="image.png"> </body> </html>' SELECT SQLHTTP.net.Html_To_Xml(@Html) |
1 2 3 4 5 6 7 8 9 10 |
<html> <head> <title>Sample Page</title> </head> <body> <img src="image.png" /> </body> </html> |