September 21, 2015 at 2:18 am
Hello,
Can one advise if it is possible to fully validate an XML file based on its XSD Collection please?
I do have an XSD Collection myCollection and then I validate using standard script
DECLARE @magna AS XML(myCollection)
SET @magna = '<?xml version="1.0" my xml file >'
All works perfect as far as we receive a valid XML, but when things go wrong (mainly multiple fields get alpha values, when we expect numeric ones),
the above script only returns the first error it finds. Is it possible to receive in one go the list of all the issues, please?
Massive thanks in advance.
September 21, 2015 at 2:55 am
BOR15K (9/21/2015)
Hello,Can one advise if it is possible to fully validate an XML file based on its XSD Collection please?
I do have an XSD Collection myCollection and then I validate using standard script
DECLARE @magna AS XML(myCollection)
SET @magna = '<?xml version="1.0" my xml file >'
All works perfect as far as we receive a valid XML, but when things go wrong (mainly multiple fields get alpha values, when we expect numeric ones),
the above script only returns the first error it finds. Is it possible to receive in one go the list of all the issues, please?
Massive thanks in advance.
Quick answer is NO, the validation will error out and exit at the first error. Alternatives would be either parsing the XSD or the XML and cumulatively apply them.
😎
Have a look at this article: XML Schema validation in SQL Server[/url]
September 21, 2015 at 3:19 am
Thank you for pointing to the article!
October 7, 2015 at 3:50 am
You can validate multiple elements in an XML file using .Net. But not using SQL XML.
I don't have the environment to test this, but I think that the code in this article will do it:
http://codedisplay.com/validate-xml-file-aganist-xsd-using-asp-net-c-vb-net/
Russel Loski, MCSE Business Intelligence, Data Platform
January 14, 2016 at 1:54 am
Got to know more. Thank you
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply