SSIS XML Source not failing with different XML

Answered SSIS XML Source not failing with different XML

  • Friday, January 04, 2013 5:30 PM
     
     

    I am using a Data flow task with XML source.I am using a XSD which is generated in the source window itself. I parsed a defferent file with same name but different elements in the XML.The elements are different from the xsd except the header and it still parses the file without showing error.How to generate an error.I removed the delay validation too but it didn't help.

    I dont understand why it is succesful even when using an XML with different elements.

All Replies

  • Friday, January 04, 2013 5:53 PM
    Moderator
     
     Answered

    I am thinking your other files conformed to the loosely created XSD.

    I suggest you adopt a technique described in http://tsutha.blogspot.ca/2006/02/how-can-you-validate-xml-schema.html


    Arthur My Blog

    • Marked As Answer by napster463 Friday, January 04, 2013 6:25 PM
    •  
  • Friday, January 04, 2013 6:35 PM
     
     

    @Arthurz:

    When I give the file connection directly to the XML the validation is working but when I do the file connection through a variable it is failing even for corrrect XMLs.!!I keep getting the error:

    [XML Task] Error: An error occurred with the following error message: "Data at the root level is invalid. Line 1, position 1.".

    [XML Task] Error: Property "New Source" has no source Xml text; Xml Text is either invalid, null or empty string.

  • Friday, January 04, 2013 7:02 PM
    Moderator
     
     
    It might be the variable value assignment issue as there should be no difference in the logic there.

    Arthur My Blog

  • Friday, January 04, 2013 7:28 PM
     
     
    I didn't change anything in the connection string. It worked when I used source type as file connection and gave the path directly.In the second case I assigned a variable  as source type with string data type and assigned the same path that I used in connection string to it. This time it failed.
  • Friday, January 04, 2013 7:37 PM
     
     

    @Arthurz:

    I got it.I was assigning connection string variable by selecting source type variable.I used file connection created a new connection manager and in expressions assigned that variable.Now it works.Thanks for your help.

  • Friday, January 04, 2013 8:39 PM
    Moderator
     
     

    Here is an other example of the XML Task.


    Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com | Twitter