September 2, 2009 at 4:43 am
I have multiple XML documents generated from a third party application. I want to use XML Bulk Load to upload the data in the XML document into sql database and indeed I have created the necessary stored procedure to do so.
The procedure works fine, but the upload fails when the XML file contains records where an element tag is not just 'empty', but missing. The missing element/tag is consistently the same element. Which is:
XML Validation: Invalid content. Expected element(s): 'FileNo'. Found: element 'DateOfFirstEmployement' instead. Location: /*:ClsContributor[1]/*:ContributorsNew[1]/*:ContributorNew[3]/*:DateOfFirstEmployement[1].
Basically, the 3rd party application fails to generate the specified element tag for some records within the same xml file.
How can I use XML Bulk Load to load or ignore and continue processing the xml file?
Is this something I can correct within the xml schema collection creation script or in the stored proc? :ermm:
September 2, 2009 at 11:38 am
Try modifying the schema and setting "minOccurs" attribute of the element to "0" to indicate that the element is optional. That might help.
.
September 10, 2009 at 6:18 am
jacob sebastian (9/2/2009)
Try modifying the schema and setting "minOccurs" attribute of the element to "0" to indicate that the element is optional. That might help.
I wonder why I didn't think of that. You were right! Should have been my initial diagnosis of the problem. Your suggestion put me on track to resolving other problems encountered with the schema.
Virtual tankard of beer to you.
Cheers!
September 10, 2009 at 8:18 pm
Glad to know it helped. If you are coming for PASS 2009 summit, do let me know and you can grab a copy of my XSD book 🙂
.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply