當前位置: 首頁>>代碼示例>>C#>>正文


C# Schema.ValidationEventArgs類代碼示例

本文整理匯總了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");
        }
開發者ID:dotnet,項目名稱:corefx,代碼行數:26,代碼來源:TC_SchemaSet_AllowXmlAttributes.cs

示例2: myValidationEventHandler

 void myValidationEventHandler(object sender, ValidationEventArgs e)
 {
     if (e.Severity == XmlSeverityType.Error)
         throw e.Exception;
     else
         Trace.WriteLine(e.Exception.ToString());
 }
開發者ID:nujmail,項目名稱:xsd-to-classes,代碼行數:7,代碼來源:XsdToClassForm.cs

示例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");
            }
        }
開發者ID:dotnet,項目名稱:corefx,代碼行數:29,代碼來源:TC_SchemaSet_ProhibitDTD.cs

示例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);
 }
開發者ID:bgrebil,項目名稱:CommandLineTools,代碼行數:7,代碼來源:Program.cs

示例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) }));
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:7,代碼來源:WebReferenceOptions.cs

示例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
		}
開發者ID:huamouse,項目名稱:Taoqi,代碼行數:26,代碼來源:RdlUtil.cs

示例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);
 }
開發者ID:kellyelton,項目名稱:octgn-customizer,代碼行數:7,代碼來源:XmlStuff.cs

示例8: ValidationCallback

 void ValidationCallback(object sender, ValidationEventArgs args)
 {
     if (args.Severity == XmlSeverityType.Error)
     {
         throw args.Exception;
     }
 }
開發者ID:tian1ll1,項目名稱:WPF_Examples,代碼行數:7,代碼來源:SchemaValidator.cs

示例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);
 }
開發者ID:jjhesk,項目名稱:BulletMLLib,代碼行數:12,代碼來源:BulletPattern.cs

示例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);

        }
開發者ID:batas2,項目名稱:PdfSharp.Controls,代碼行數:8,代碼來源:Validator.cs

示例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);
        }
開發者ID:FelicePollano,項目名稱:Fatica.Labs.XmlEditor,代碼行數:8,代碼來源:XmlSchemaSquiggleValidator.cs

示例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}");
        }
開發者ID:Lighnat0r,項目名稱:Chaos_CSharp,代碼行數:8,代碼來源:XmlUtils.cs

示例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);
        }
開發者ID:MarkVSullivan,項目名稱:SobekCM-Web-Application,代碼行數:11,代碼來源:XmlValidator.cs

示例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;
        }
 }
開發者ID:zZzuperFly,項目名稱:RatcheterTask,代碼行數:8,代碼來源:XmlValidator.cs

示例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);
        }
開發者ID:rdwolff,項目名稱:TEM,代碼行數:8,代碼來源:Validator.cs


注:本文中的System.Xml.Schema.ValidationEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。