This is a discussion on .Net support validating XML? within the XML and SOAP forums, part of the Web Development category; Hi guys, Can any one explain .Net support validating XML documents against DTDS? Thanks devarajan.V...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Hi guys, Can any one explain .Net support validating XML documents against DTDS? Thanks devarajan.V |
|
#2
| |||
| |||
| Hi devarajan.v Yes, .Net Supports validating XML document against DTDS. In .Net framework System.Xml Namespace contains all the neccessary classes and methods to do this. Some of the Classes for this perpose are... XmlTextReader in System.Xml Namespace XmlValidatingReader in System.Xml Namespace XmlSchema in System.Xml.Schema Namespace XmlSchemaCollection in System.Xml.Schema Namespace Hope usefull to u.. Oxygen |
|
#3
| |||
| |||
| private void ValidatingProcess(string XSDPath, string XMLPath) { try { Reader = new XmlTextReader(XMLPath); StreamReader SR = new StreamReader(XSDPath); XmlSchema Schema = new XmlSchema(); Schema = XmlSchema.Read(SR, new ValidationEventHandler(ValidatingReader_Validation EventHandler)); XmlValidatingReader ValidatingReader = new XmlValidatingReader(Reader); ValidatingReader.ValidationType = ValidationType.Schema; ValidatingReader.Schemas.Add(Schema); ValidatingReader.ValidationEventHandler += new ValidationEventHandler(ValidatingReader_Validation EventHandler); while (ValidatingReader.Read()) {/*Empty loop*/} } catch (UnauthorizedAccessException AccessEx) { throw AccessEx; } catch (Exception Ex) { throw Ex; } } private void ValidatingReader_ValidationEventHandler(object sender, ValidationEventArgs args) { // 10- Implement your logic for each validation iteration string strTemp; strTemp = "Line: " + this.Reader.LineNumber + " - Position: " + this.Reader.LinePosition + " - " + args.Message; this.Results.Add(strTemp); } |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| validating a form AND preventing multiple clicks | sureshbb | HTML, CSS and Javascript Coding Techniques | 1 | 12-04-2007 12:14 AM |
| Validating Numbers | ragavraj | PHP Programming | 1 | 11-07-2007 06:12 AM |
| If I am validating a form AND preventing multiple clicks, is the following code corre | theone | HTML, CSS and Javascript Coding Techniques | 1 | 07-30-2007 05:13 AM |
| Which JavaScript file is referenced for validating the validators at the client side? | sundarraja | ASP and ASP.NET Programming | 1 | 07-27-2007 04:26 AM |
| Which Javascript file is referenced for validating the validators at the client side? | mobilegeek | HTML, CSS and Javascript Coding Techniques | 1 | 07-25-2007 10:15 PM |
Our Partners |