New Message on dotNET User Group Hyd

XML schema

Reply
  Reply to Sender   Recommend Message 4 in Discussion
From: Chandra_Chivukula_MVP

Phani/SirisChanti - If I understand your question correctly, then you should be using the XmlValidatingReader class to validate the xml document against a specified schema definition.
 
Here is a sample (quick and dirty) snippet that could give you an idea on how to do this - (this code will not compile as-is, you will have to add additional wireups to make it work)

XmlTextReader xmlReader = new XmlTextReader (xmlDataFile);

XmlValidatingReader validatingReader = new XmlValidatingReader (xmlReader);

validatingReader.ValidationEventHandler += new ValidationEventHandler (this.SchemaValidationHandler);

validatingReader.Schemas.Add (null, xsdLocation);  // this is the location where you will give in your schema definition (XSD...)

xmlDocument.Load (validatingReader);

The SchemaValidationHandler event will fire whenever the validating reader sees an issue in matching the xml node/value to the corresponding location in the schema definition allowing you to decide if the matching issue (error/warning) is ignorable or if it is fatal.
 
 
If you should need any additional info, or if this info is not very clear, then do no hesitate to post back.
 
- Chandra Chivukula
 

View other groups in this category.

Click here
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to