locked
XML Validation error before validation RRS feed

  • Question

  • I WOULD LIKE TO DETECT ERRORS WHERE AN ELEMENT HAS NO SUB-ELEMENTS IN XSD, BUT DOES HAVE SUB-ELEMENTS IN XML using XML Task with OperationType: Validate (standard XML validation in SSIS).

    However, the package fails before it starts:

    Error at XML Task [XML Source[693]]: The XML Source.Outputs[field_name] contains a RowsetID with a value of field_name that does not reference a data in the schema.

    Here's the xsd vs xml issue:

    XSD:

    xs:element minOccurs="0" name="field_name" />

    XML:

            <field_name>
              <price>150</price>
              <count>10</count>
            </field_name>

    Failing at a validation XML task would allow me to skip the file and continue with the package execution.  SSIS 2012.  Any help apprectiated.  Tx.

    Friday, January 15, 2016 1:57 PM

Answers

  • Hi pl80,

    Luckily I think starting with SSIS 2012 we now have the ability to validate a XML file against XSD.

    I will give you a link in terms of a good start: http://microsoft-ssis.blogspot.ca/2012/08/validating-xml-file-against-xsd-with.html 


    Arthur

    MyBlog


    Twitter

    Friday, January 15, 2016 7:49 PM

All replies

  • Hi pl80,

    Luckily I think starting with SSIS 2012 we now have the ability to validate a XML file against XSD.

    I will give you a link in terms of a good start: http://microsoft-ssis.blogspot.ca/2012/08/validating-xml-file-against-xsd-with.html 


    Arthur

    MyBlog


    Twitter

    Friday, January 15, 2016 7:49 PM
  • Actually, you can validate against XSD in previous versions.  I used SSIS 2008 R2.


    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

    Saturday, January 16, 2016 10:46 AM
  • Hi,

    While loading XML using XML Source task, it will ask for XSD file if you have already created else Generate new XSD automatically based on input XML - http://www.allaboutmssql.com/2013/08/ssis-shred-data-from-xml-file-in-folder.html

    If you want to validate your XML to have sub elements always while loading, set minoccurs  & maxoccurs accordingly in XSD - http://www.w3schools.com/xml/el_sequence.asp


    sathya - My blog ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

    Saturday, January 16, 2016 3:37 PM