473,395 Members | 1,738 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,395 software developers and data experts.

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 XmlValidatingReader.

TIA,

JoeZ
Feb 27 '07 #1
1 1329
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 XmlValidatingReader.

TIA,

JoeZ
Try this:
FileStream fs = File.Open("../../signatureinstance.xml",
FileMode.Open);
XmlTextReader reader = new XmlTextReader(fs);
XmlValidatingReader xvr = new XmlValidatingReader(reader);
xvr.ValidationType = ValidationType.Schema;
xvr.Schemas.Add(null, "../../signatureschema.xsd");
xvr.ValidationEventHandler += new
ValidationEventHandler(xvr_ValidationEventHandler) ;
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
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...
16
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...
1
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....
1
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
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...
8
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...
1
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
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...
0
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
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,...

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.