473,408 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

SSIS+XML+XSD+C# : Detect and log errors

Hi every body,

While validating my xml file with an .xsd schema, i need to detect all errors in order to load the line of data (or the key) + the error message ...

then save it into a log file or idealy directly to a database.

Exemple:
ID Name Sex Age
1 Jo M L
2 Sandy F 18
3 Sam 1 30

Now, in my .xsd, the sex must be either M or F ... and the Age must be an integer.

so i need to detect that both lines 1 and 3 are not good according to my xsd.... however the line 2 is good.

In my Errors table, i need to log something like this (or anything else similar:

1 Age 'the value is not an integer'
3 Sex 'The value is not in the enum {M,F}'

Whe i used this, i got the what you can see in the images here attached. however it is not enough:
MessageBox.Show(args.Severity.ToString() + " *** "+ args.Exception.ToString() + " $$$ "+ args.Exception.LineNumber.ToString() + " ### "+ args.Exception.LinePosition.ToString());


Then, I used this code to access the xml node that contains the error. however the ex.SourceObject is always null. this is my problem....

public void ValidationEventHandler(object sender, ValidationEventArgs args)
{
XmlSchemaValidationException ex = (XmlSchemaValidationException) args.Exception;
XmlNode node = (XmlNode)ex.SourceObject;
}

I also posted my question here :
http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/ca2ec8f7-2f36-48b7-956a-ddf819dba2a9


Is their an other way ?
Thank you very much
Attached Images
File Type: jpg Capture1.JPG (32.0 KB, 196 views)
File Type: jpg Capture2.JPG (30.3 KB, 386 views)
Feb 15 '13 #1
0 1375

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Manish Jethani | last post by:
Hi all, Is there a way to detect typos in a Python program, before actually having to run it. Let's say I have a function like this: def server_closed_connection(): session.abost() Here,...
0
by: Larry | last post by:
I know how to detect errors if a stored procedure is used, by adding a ReturnValue parameter to the command object and then in the stored procedure having a RETURN @@ERROR But, If I am using...
2
by: Trev | last post by:
SQL Server 2000 BE, Access 2002 FE. I want to write a stored procedure, that will among other things log errors to a table, I want to be able to report a summary of work done and errors to the...
24
by: Massimo Soricetti | last post by:
Hello, I'm not a C newbie, but I'm teaching C programming (well... FIRST programming and then C) to other guys these days and it's driving me to some reflexions on the language. It's not...
5
by: phillip.s.powell | last post by:
$sql = "SELECT IF((SHOW TABLES LIKE '$subselectTableName'), count(*), NULL) AS numRows FROM $subselectTableName"; I am trying to write a SQL statement that will tell me if a table exists or not,...
78
by: Robert Baer | last post by:
The homepage i have had up and seemingly working is: http://oil4lessllc.com/ However, the validator has so many complaints, and being so incompetent, i have no clue as to how to fix it all. Would...
2
by: Dan D | last post by:
I have a large install file (an exe) on my web server that people download and install from. Looking at my log files, I see a lot of people downloading it, but no way to tell for sure if they...
7
by: unix_fan | last post by:
What is the best way to poll a directory for the arrival of files? The OpenGroup (http://www.opengroup.org/onlinepubs/007908799/xsh/readdir.html) says: If a file is removed from or added to...
5
by: Edgard Guilherme | last post by:
Hello all, b4 anything, i am using iis smtp to send the emails.. is there anyway to detect if the "To" email is a valid one ? Like for eg. To = sadjwqewe@askjqw.com (so this email of course...
1
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all mister, Which is THE BEST WAY IN THE WORLD AROUND for: 1. detect Network
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.