473,748 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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.ToSt ring() + " ### "+ args.Exception. LinePosition.To String());


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 ValidationEvent Handler(object sender, ValidationEvent Args args)
{
XmlSchemaValida tionException ex = (XmlSchemaValid ationException) args.Exception;
XmlNode node = (XmlNode)ex.Sou rceObject;
}

I also posted my question here :
http://social.msdn.mic rosoft.com/Forums/en-US/sqlintegrations ervices/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, 198 views)
File Type: jpg Capture2.JPG (30.3 KB, 391 views)
Feb 15 '13 #1
0 1392

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

Similar topics

15
3591
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, abort() is actually misspelt. The only time my program follows this path is when the server disconnects from its
0
3017
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 the follwoing code in VB 6, How can I tell if the insert executed ok? I have to add error checking to a project that uses this
2
2428
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 user and let them decide whether to commit or rollback. I so far foresee a couple of problems. 1. Inside a transaction, I write to the error log table, will I be able to read it back again before commit/rollback?
24
2499
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 uncommon to forget a } writing code, and at compiling time get an error 18956778 lines after the mistake, in an otherwise absolutely correct piece of code. Or, sometimes in my journeys I got errors reported in a file, checked and found it correct, and...
5
3941
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, this is because PHP will throw Fatal Errors and halt all programming if the table does not exist that I attempt to query. How do you write an elegant MySQL 4.1+ statement to detect if a table exists or not?
78
4914
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 the use of Dreamweaver be of great help?
2
23897
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 completed the download or cancelled out before it completed. Is there any function in PHP that would allow the web server to send the file and detect a completion or cancellation? Or perpahs a javascript/PHP method? Any help would be greatly...
7
1782
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 the directory after the most recent call to opendir() or rewinddir(), whether a subsequent call to readdir() returns an entry for that file is unspecified.
5
3018
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 doesnt exist, but is there anyway to detect that ?, or if the email exist but the inbox is full etc..)
1
6685
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
8995
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9332
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8252
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.