本文整理汇总了C#中System.Xml.Schema.ValidationEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ValidationEventArgs类的具体用法?C# ValidationEventArgs怎么用?C# ValidationEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValidationEventArgs类属于System.Xml.Schema命名空间,在下文中一共展示了ValidationEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidationCallback
//hook up validaton callback
public void ValidationCallback(object sender, ValidationEventArgs args)
{
if (args.Severity == XmlSeverityType.Warning)
{
_output.WriteLine("WARNING: ");
bWarningCallback = true;
warningCount++;
}
else if (args.Severity == XmlSeverityType.Error)
{
_output.WriteLine("ERROR: ");
bErrorCallback = true;
errorCount++;
}
XmlSchemaException se = args.Exception as XmlSchemaException;
_output.WriteLine("Exception Message:" + se.Message + "\n");
if (se.InnerException != null)
{
_output.WriteLine("InnerException Message:" + se.InnerException.Message + "\n");
}
else
_output.WriteLine("Inner Exception is NULL\n");
}
示例2: myValidationEventHandler
void myValidationEventHandler(object sender, ValidationEventArgs e)
{
if (e.Severity == XmlSeverityType.Error)
throw e.Exception;
else
Trace.WriteLine(e.Exception.ToString());
}
示例3: ValidationCallback
//hook up validaton callback
public void ValidationCallback(object sender, ValidationEventArgs args)
{
switch (args.Severity)
{
case XmlSeverityType.Warning:
_output.WriteLine("WARNING: ");
bWarningCallback = true;
warningCount++;
break;
case XmlSeverityType.Error:
_output.WriteLine("ERROR: ");
bErrorCallback = true;
errorCount++;
break;
}
_output.WriteLine("Exception Message:" + args.Exception.Message + "\n");
if (args.Exception.InnerException != null)
{
_output.WriteLine("InnerException Message:" + args.Exception.InnerException.Message + "\n");
}
else
{
_output.WriteLine("Inner Exception is NULL\n");
}
}
示例4: OnValidationError
static void OnValidationError(object sender, ValidationEventArgs e)
{
if (e.Severity == XmlSeverityType.Warning)
Console.WriteLine("\tWarning: Matching schema not found. No validation occurred. " + e.Message);
else
Console.WriteLine("\tValidation error: " + e.Message);
}
示例5: SchemaValidationHandler
private static void SchemaValidationHandler(object sender, ValidationEventArgs args)
{
if (args.Severity == XmlSeverityType.Error)
{
throw new InvalidOperationException(System.Web.Services.Res.GetString("WsdlInstanceValidationDetails", new object[] { args.Message, args.Exception.LineNumber.ToString(CultureInfo.InvariantCulture), args.Exception.LinePosition.ToString(CultureInfo.InvariantCulture) }));
}
}
示例6: ValidationHandler
private void ValidationHandler(object sender, ValidationEventArgs args)
{
sbValidationErrors.AppendLine(args.Message);
XmlSchemaValidationException vx = args.Exception as XmlSchemaValidationException;
// 02/07/2010 Defensive programming, also check for valid SourceObject.
if ( vx != null && vx.SourceObject != null )
{
if ( vx.SourceObject is XmlElement )
{
XmlElement xSourceObject = vx.SourceObject as XmlElement;
sbValidationErrors.AppendLine("Source object for the exception is " + xSourceObject.Name + ". ");
sbValidationErrors.AppendLine(xSourceObject.OuterXml);
}
else if ( vx.SourceObject is XmlAttribute )
{
XmlAttribute xSourceObject = vx.SourceObject as XmlAttribute;
sbValidationErrors.AppendLine("Source object for the exception is " + xSourceObject.Name + ". ");
sbValidationErrors.AppendLine(xSourceObject.OuterXml);
if ( xSourceObject.ParentNode != null )
sbValidationErrors.AppendLine(xSourceObject.ParentNode.OuterXml);
}
}
#if DEBUG
Debug.WriteLine(sbValidationErrors);
#endif
}
示例7: ValidationCallBack
public void ValidationCallBack(Object sender, ValidationEventArgs args)
{
//'Display the validation error. This is only called on error
m_Success = false; //'Validation failed
//writertbox("Validation error: " + args.Message);
App.addDebugLine("Validation Error: " + args.Message);
}
示例8: ValidationCallback
void ValidationCallback(object sender, ValidationEventArgs args)
{
if (args.Severity == XmlSeverityType.Error)
{
throw args.Exception;
}
}
示例9: MyValidationEventHandler
/// <summary>
/// delegate method that gets called when a validation error occurs
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="args">Arguments.</param>
public static void MyValidationEventHandler(object sender, ValidationEventArgs args)
{
throw new XmlSchemaException("Error validating bulletml document: " + args.Message,
args.Exception,
args.Exception.LineNumber,
args.Exception.LinePosition);
}
示例10: ValidationCallBack
private void ValidationCallBack(object sender, ValidationEventArgs args)
{
if (args.Severity == XmlSeverityType.Warning)
ValidationErrors.Add("Warning: Matching schema not found. No validation occurred." + args.Message);
else
ValidationErrors.Add("Validation error: " + args.Message);
}
示例11: OnValidate
protected void OnValidate(object _, ValidationEventArgs vae)
{
var offset = textArea.Document.PositionToOffset(new TextLocation(vae.Exception.LinePosition-1,vae.Exception.LineNumber-1));
var mk = new TextMarker(offset, GetWordLen(offset), TextMarkerType.WaveLine, vae.Severity == XmlSeverityType.Error ? Color.DarkBlue : Color.Green);
mk.ToolTip = vae.Message;
textArea.Document.MarkerStrategy.AddMarker(mk);
}
示例12: xmlValidationEventHandler
static private void xmlValidationEventHandler(object sender, ValidationEventArgs e)
{
// TODO(Ligh): Do more with the error here.
Debug.WriteLine($"ERROR: {e.Message}");
throw new System.Exception($"Xml validation error: {e.Message}");
}
示例13: MyValidationEventHandler
/// <summary> EventHandler is called when there is an error during validation </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void MyValidationEventHandler(object sender, ValidationEventArgs args)
{
// Set the flag
isValid = false;
// Add this error to the building list of errors
errors.AppendLine(args.Message);
}
示例14: SchemaValidationEventHandler
private void SchemaValidationEventHandler(object sender, ValidationEventArgs e)
{
if(e.Severity == XmlSeverityType.Error || e.Severity == XmlSeverityType.Warning )
{
_logProxy.LogThis(MessageImportance.High, e.Severity + " " + e.Message);
isCorrectXml = false;
}
}
示例15: ValidationCallBack
private void ValidationCallBack(object sender, ValidationEventArgs args)
{
isValid = false;
if (sb.Length > 0) sb.Append("<br/>");
if (args.Severity == XmlSeverityType.Warning) sb.Append("Warning: Matching schema not found. No validation occurred." + args.Message);
else sb.AppendLine("Validation error: " + args.Message);
}