CSharp/C# >> Looking for some sample codes in C#

by JoeZ » Wed, 28 Feb 2007 00:10:48 GMT

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



CSharp/C# >> Looking for some sample codes in C#

by Matt Lacey » Wed, 28 Feb 2007 00:22:36 GMT



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

Similar Threads

1. I'm looking for RasDial code sample in C#

2. Looking for sample code

3. Creating a Database using the STL: Newbie looking for code samples

4. Delphi 7, Excel - have problem - looking for sample code - Delphi VCL Component

5. looking for code sample for non-blocking TCP sockets

Hi,

I need a code sample for doing this:

-  support for multiple agents that know each other and can talk each other
   over a non-blocking TCP socket.
   each agent can send and recieve data to/from each other.
-  handling agent down events (i don't know how to do it in an elegant way 
when using the socket select method).

I prefer to use the Socket.Select method.
All the socket operations must be in a non-blocking mode.

Thanks.

6. Looking for WinSNMP sample code

7. Looking for sample code to send email with exchange

Does anybody have sample code to send email using exchange from an MFC
application.

Thanks

Tom G


8. looking for custom control sample code