IsXmlValid
Checks the validity of an XML
- Free Function
- SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017
SELECT SQLHTTP.net.IsXmlValid( @XmlString )
Name | Type | Description |
---|---|---|
@XmlString | nvarchar(MAX) | String to validate. |
bit
0 = XML is NOT Valid
1 = XML IS Valid
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
DECLARE @XmlString nvarchar(MAX) SET @XmlString = '<?xml version="1.0" encoding="UTF-8"?> <DocumentElement param="value"> <FirstElement> ¶ Some Text </FirstElement> <?some_pi some_attr="some_value"?> <SecondElement param2="something"> Pre-Text <Inline>Inlined text</Inline> Post-text. </SecondElement> </DocumentElement>' SELECT SQLHTTP.net.IsXmlValid(@XmlString) |
1 2 3 4 5 |
----- 1 |