Files
mono/mcs/class/System.XML/System.Xml.Schema/ValidationHandler.cs
T
Atsushi Eno c62c061680 2003-09-30 Atsushi Enomoto <[email protected]>
* Forgot to append 8/24/2003 ChangeLog.
	* BUGS.txt, BUGS-MS.txt : Appended additional bug info.
	* BuiltInDatatype.cs, ValidationHandler.cs, XmlSchema.cs,
	  XmlSchemaAll.cs, XmlSchemaAnnotation.cs. XmlSchemaAny.cs,
	  XmlSchemaAnyAttribute.cs, XmlSchemaAttribute.cs,
	  XmlSchemaAttributeGroup.cs, XmlSchemaAttributeGroupRef.cs,
	  XmlSchemaChoice.cs, XmlSchemaCollection.cs,
	  XmlSchemaComplexContent.cs, XmlSchemaComplexContentExtension.cs,
	  XmlSchemaComplexContentRestriction.cs, XmlSchemaComplexType.cs,
	  XmlSchemaContent.cs, XmlSchemaDatatype.cs, XmlSchemaElement.cs,
	  XmlSchemaException.cs, XmlSchemaGroup.cs, XmlSchemaGroupBase.cs,
	  XmlSchemaGroupRef.cs, XmlSchemaIdentityConstraint.cs,
	  XmlSchemaKey.cs, XmlSchemaKeyref.cs, XmlSchemaNotation.cs,
	  XmlSchemaObject.cs, XmlSchemaObjectTable.cs, XmlSchemaParticle.cs,
	  XmlSchemaReader.cs, XmlSchemaSequence.cs, XmlSchemaSimpleContent.cs,
	  XmlSchemaSimpleContentExtension.cs,
	  XmlSchemaSimpleContentRestriction.cs, XmlSchemaSimpleType.cs,
	  XmlSchemaSimpleTypeContent.cs, XmlSchemaSimpleTypeList.cs,
	  XmlSchemaSimpleTypeRestriction.cs, XmlSchemaSimpleTypeUnion.cs,
	  XmlSchemaType.cs, XmlSchemaUnique.cs, XmlSchemaUtil.cs,
	  XmlSchemaXPath.cs :

	  - Almost all classes are changed to implement schema component
	    constraints, and schema validation using XsdValidatingReader.
	  - better exception messages.
	  - More datatype support.
	  and so on.

svn path=/trunk/mcs/; revision=18444
2003-09-30 19:17:56 +00:00

64 lines
2.0 KiB
C#
Executable File

using System;
namespace System.Xml.Schema
{
/// <summary>
/// </summary>
public delegate void ValidationEventHandler(object sender,ValidationEventArgs e);
/// <summary>
/// Docs say we need to raise an exception if ValidationEventHandler is not set(null)
/// So we use this class to raise the events rather than calling the delegate by itself
/// </summary>
internal class ValidationHandler
{
public static void RaiseValidationEvent(ValidationEventHandler handle,
Exception innerException,
string message,
XmlSchemaObject xsobj,
object sender,
string sourceUri,
XmlSeverityType severity)
{
XmlSchemaException ex = new XmlSchemaException (
message, sender, sourceUri, xsobj, innerException);
ValidationEventArgs e = new ValidationEventArgs(ex,message,severity);
if(handle == null)
{
throw e.Exception;
}
else
{
handle(sender,e);
}
}
/*
public static void RaiseValidationEvent(ValidationEventHandler handle, Exception innerException, object sender, string message, XmlSeverityType severity)
{
RaiseValidationEvent(handle,null,sender,message,XmlSeverityType.Error);
}
public static void RaiseValidationError(ValidationEventHandler handle, object sender, string message)
{
RaiseValidationEvent(handle,null,sender,message,XmlSeverityType.Error);
}
public static void RaiseValidationError(ValidationEventHandler handle, string message, Exception innerException)
{
RaiseValidationEvent(handle, innerException, null, message, XmlSeverityType.Error);
}
public static void RaiseValidationWarning (ValidationEventHandler handle, object sender, string message)
{
RaiseValidationEvent(handle,null,sender,message,XmlSeverityType.Warning);
}
public static void RaiseValidationWarning(ValidationEventHandler handle, string message, Exception innerException)
{
RaiseValidationEvent(handle, innerException, null, message, XmlSeverityType.Warning);
}
*/
}
}