XML Validation in SSIS
Hi,
I have an XML file and it's XSD file,whenI use an other tool (Stylus studio) the XML file is valide and weelformed. But in SSIS using XML taskusing the same XSD and XML I get a "False", so the XMl file is not valide.
Have you an idea obout this
thank you in advance
April 17th, 2008 10:39am
can you use a sample data ( one record ) does this work?
Are you using any thing usual in the XML?
Free Windows Admin Tool Kit Click here and download it now
April 17th, 2008 4:12pm
Hi,
I have test it onlywith a record and it does not work, but it works with Stylus.
April 18th, 2008 4:23am
Can you give me a sample please
Free Windows Admin Tool Kit Click here and download it now
April 21st, 2008 6:16am
Hi,
I can not, because they are confidential data and it is a very big XMLfile.
April 21st, 2008 9:38am
The XML Source uses the Microsoft XML parser, so perhaps the document isn't valid by it's standards. If you are familiar with C#, you can modify the following code to load and validate your XML doc with the MS parser.
Code Snippet
XmlReaderSettings settings = new XmlReaderSettings();
settings.Schemas.Add("YourSchema.xsd", XmlReader.Create(new StreamReader("c:\\YourSchema.xsd")));
settings.ValidationType = ValidationType.Schema;
XmlDocument test = new XmlDocument();
test.Load(XmlReader.Create(new StreamReader("C:\\YourXMLDoc.XML"), settings));
if (test.SchemaInfo.Validity != System.Xml.Schema.XmlSchemaValidity.Valid)
{
//Not Valid
}
That might help determine what the problem is.
Free Windows Admin Tool Kit Click here and download it now
April 22nd, 2008 10:26pm
Here is an other Script Task example for validating an XML file:
http://microsoft-ssis.blogspot.com/2012/08/validating-xml-file-against-xsd-with_6.html
Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com |
Twitter
August 6th, 2012 8:09am