473,804 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Looking for some sample codes in C#

Hi all,

I am looking for some sample codes in C#, in which, it can read a schema xsd
file and use it to validate an xml stream or file. Ideally the sample will
use XmlValidatingRe ader.

TIA,

JoeZ
Feb 27 '07 #1
1 1344
On 27 Feb, 16:10, "JoeZ" <j...@microsoft .comwrote:
Hi all,

I am looking for some sample codes in C#, in which, it can read a schema xsd
file and use it to validate an xml stream or file. Ideally the sample will
use XmlValidatingRe ader.

TIA,

JoeZ
Try this:
FileStream fs = File.Open("../../signatureinstan ce.xml",
FileMode.Open);
XmlTextReader reader = new XmlTextReader(f s);
XmlValidatingRe ader xvr = new XmlValidatingRe ader(reader);
xvr.ValidationT ype = ValidationType. Schema;
xvr.Schemas.Add (null, "../../signatureschema .xsd");
xvr.ValidationE ventHandler += new
ValidationEvent Handler(xvr_Val idationEventHan dler);
XmlDocument xdoc = new XmlDocument();
xdoc.Load(xvr);

Courtesy of:
http://www.codeproject.com/useritems/XmlValidation.asp

Or, you could try here:
http://support.microsoft.com/kb/318504

Feb 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1435
by: Beringer | last post by:
Hello, I am currently looking for databases that contain available prescription medications and diagnosis codes (i.e. ICD9 medical diagnosis codes) that have been created using SQL. Anybody know of companies that have these commerically available? Thanks, Eric
16
2181
by: Voetleuce en f?nsievry | last post by:
G'day I have some pages written by a bot and much of the code does not concern the visible content on the site. I'd like to strip all the codes that do not affect or influence the visible stuff (although I'd like to keep the nested tables, if possible). Some of this can be stripped using Search/Replace, but some of it contains codes which differ from page to page. How many pages? About 750, totalling 80 megabytes of data, which I'm
1
369
by: Li Weng | last post by:
Hi, I tried "Getting the size of a Mailbox(WebDAV)" from Exchange Server 2003 in MSDN blog: http://blogs.msdn.com/kclemson/archive/2004/01/23/62247.aspx But I got error: (400) bad request. at GetResponse call. I tried Sending a Message and it success. So look like logon and connection
1
2160
by: Al Bahr | last post by:
Hi, Anyone aware of sample codes or article on creating Charts such as line, or Bar in VB.net? Thanks Al
3
1837
by: Grant | last post by:
I need some sample code showing how to manipulate data in my access database using C#. This is what Im trying to do: Dropdownlist with datagrid both bound to datasource. When the drop down list value changes - the datagrid values change accordingly. I managed to get this working by setting the currencymanager to the dropdownlist selectedIndex (which is probably the wrong way to do it, bu the datagrid seems to update its values correctly)...
8
2446
by: Steve | last post by:
Hi; I had a big link checking job to do and it has been years since I have done anything like that so I found a test page to use that I knew had bad links on it( a friends site ) and I decided to test the various free services out. I tried about 5 different link checkers on the test page I had , including Xenu and NetMechanic. I got 5 sets of identical results.
1
1779
by: rengaraj | last post by:
hello friends i am looking for algorithm of logarithm function.how does it work?could you help me on this or send me sample codes thanks in advance
3
18791
by: ThatsIT.net.au | last post by:
I'm looking for a very simple nested grid view example. Also I have been creating tables instead of using gridview for complex tasks or just spitting out html from code. Do you recommend using nested gridviews?
0
870
by: fatimang | last post by:
hello., please show me sample codes on making a LISTBOX object., how to insert records in the LISTBOX? how to declare array? please show me the codes for navigation., how to open a new frame or form using a button?
0
9593
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,...
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10335
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
10088
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...
1
7633
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
6862
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
5529
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...
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.