C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




how do u load XML document and perform validations


Posted Date: 26 Jul 2008      Total Responses: 2

Posted By: syam kumar       Member Level: Silver     Points: 1



how do u load XML document and perform validations




Responses

Author: Ravindragiri 91 984 438 6058    27 Jul 2008Member Level: SilverRating:     Points: 6

protected void Page_Load(object sender, EventArgs e)
{
string xmlPath = MapPath("AuthorsWithInlineSchema.xml");
XmlReader reader = null;
XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.Schema;
settings.ValidationEventHandler += new ValidationEventHandler(this.ValidationEventHandler);
//settings.ValidationFlags &= ~XmlSchemaValidationFlags.IgnoreInlineSchema;
//settings.ValidationFlags &= ~XmlSchemaValidationFlags.IgnoreValidationWarnings;
settings.ValidationFlags &= XmlSchemaValidationFlags.ProcessInlineSchema;
settings.ValidationFlags &= XmlSchemaValidationFlags.ReportValidationWarnings;
reader = XmlReader.Create(xmlPath, settings);
while (reader.Read())
{
}
if (stringBuilder.ToString() == String.Empty)
Response.Write("Validation completed successfully.");
else
Response.Write("Validation Failed. <br>" + stringBuilder.ToString());

}

void ValidationEventHandler(object sender, ValidationEventArgs args)
{
if (args.Severity == XmlSeverityType.Error)
{
stringBuilder.Append("Validation error: " + args.Message + "<br>");
}
}



Author: Ratheesh    29 Jul 2008Member Level: GoldRating:     Points: 1

<store id="1">
- <products>
- <product id="2">
- <categories>
- <category id="3">
<description />
<id>430</id>
<name />
<parent />
</category>
</categories>
<cost>121.49</cost>
<description>510 g (18 OZ)</description>
<id>0</id>
- <image id="4">
<path>/home/epocolis/Desktop/downloads/Completed/no_pic.jpg</path>
</image>
<imagePath />
<listPrice>0.00</listPrice>
<model>11224P</model>
<name />
<sellPrice>151.21</sellPrice>
<type>product</type>
<unique_hash>3935b9d1465fdf5ec5233659c1bb303e</unique_hash>
<weight>0</weight>
</product>



Post Reply
You must Sign In to post a response.
Next : About Signout link in Masterpage
Previous : diff b/w server.Execute and resposce.redirect
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use