• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Schema.XmlSchemaException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Xml.Schema.XmlSchemaException的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaException类的具体用法?C# XmlSchemaException怎么用?C# XmlSchemaException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XmlSchemaException类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DenyUnrestricted

		public void DenyUnrestricted ()
		{
			// can we call everything without a SecurityException ?
			XmlSchemaException xe = new XmlSchemaException (String.Empty, null);
			Assert.AreEqual (0, xe.LineNumber, "LineNumber");
			Assert.AreEqual (0, xe.LinePosition, "LinePosition");
			Assert.IsNotNull (xe.Message, "Message");
			Assert.IsNull (xe.SourceSchemaObject, "SourceSchemaObject");
			Assert.IsNull (xe.SourceUri, "SourceUri");
		}
开发者ID:xzkmxd,项目名称:mono,代码行数:10,代码来源:XmlSchemaExceptionCas.cs


示例2: CheckDefaultValue

 public static void CheckDefaultValue(string value, SchemaAttDef attdef, SchemaInfo sinfo, XmlNamespaceManager nsManager, XmlNameTable NameTable, object sender, ValidationEventHandler eventhandler, string baseUri, int lineNo, int linePos)
 {
     try
     {
         XmlSchemaDatatype datatype = attdef.Datatype;
         if (datatype != null)
         {
             if (datatype.TokenizedType != XmlTokenizedType.CDATA)
             {
                 value = value.Trim();
             }
             if (value.Length != 0)
             {
                 object pVal = datatype.ParseValue(value, NameTable, nsManager);
                 XmlTokenizedType tokenizedType = datatype.TokenizedType;
                 if (tokenizedType == XmlTokenizedType.ENTITY)
                 {
                     if (datatype.Variety == XmlSchemaDatatypeVariety.List)
                     {
                         string[] strArray = (string[]) pVal;
                         for (int i = 0; i < strArray.Length; i++)
                         {
                             BaseValidator.ProcessEntity(sinfo, strArray[i], sender, eventhandler, baseUri, lineNo, linePos);
                         }
                     }
                     else
                     {
                         BaseValidator.ProcessEntity(sinfo, (string) pVal, sender, eventhandler, baseUri, lineNo, linePos);
                     }
                 }
                 else if ((tokenizedType == XmlTokenizedType.ENUMERATION) && !attdef.CheckEnumeration(pVal))
                 {
                     XmlSchemaException ex = new XmlSchemaException("Sch_EnumerationValue", pVal.ToString(), baseUri, lineNo, linePos);
                     if (eventhandler == null)
                     {
                         throw ex;
                     }
                     eventhandler(sender, new ValidationEventArgs(ex));
                 }
                 attdef.DefaultValueTyped = pVal;
             }
         }
     }
     catch
     {
         XmlSchemaException exception2 = new XmlSchemaException("Sch_AttributeDefaultDataType", attdef.Name.ToString(), baseUri, lineNo, linePos);
         if (eventhandler == null)
         {
             throw exception2;
         }
         eventhandler(sender, new ValidationEventArgs(exception2));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:53,代码来源:XdrValidator.cs


示例3: CheckDefaultValue

 public static void CheckDefaultValue(SchemaAttDef attdef, SchemaInfo sinfo, IValidationEventHandling eventHandling, string baseUriStr)
 {
     try
     {
         if (baseUriStr == null)
         {
             baseUriStr = string.Empty;
         }
         XmlSchemaDatatype datatype = attdef.Datatype;
         if (datatype != null)
         {
             object defaultValueTyped = attdef.DefaultValueTyped;
             XmlTokenizedType tokenizedType = datatype.TokenizedType;
             if (tokenizedType == XmlTokenizedType.ENTITY)
             {
                 if (datatype.Variety == XmlSchemaDatatypeVariety.List)
                 {
                     string[] strArray = (string[]) defaultValueTyped;
                     for (int i = 0; i < strArray.Length; i++)
                     {
                         BaseValidator.ProcessEntity(sinfo, strArray[i], eventHandling, baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
                     }
                 }
                 else
                 {
                     BaseValidator.ProcessEntity(sinfo, (string) defaultValueTyped, eventHandling, baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
                 }
             }
             else if (((tokenizedType == XmlTokenizedType.ENUMERATION) && !attdef.CheckEnumeration(defaultValueTyped)) && (eventHandling != null))
             {
                 XmlSchemaException exception = new XmlSchemaException("Sch_EnumerationValue", defaultValueTyped.ToString(), baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
                 eventHandling.SendEvent(exception, XmlSeverityType.Error);
             }
         }
     }
     catch (Exception)
     {
         if (eventHandling != null)
         {
             XmlSchemaException exception2 = new XmlSchemaException("Sch_AttributeDefaultDataType", attdef.Name.ToString());
             eventHandling.SendEvent(exception2, XmlSeverityType.Error);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:44,代码来源:DtdValidator.cs


示例4: WarningDetails

 internal static string WarningDetails(XmlSchemaException exception, string message) {
     string details;
     XmlSchemaObject source = exception.SourceSchemaObject;
     if (exception.LineNumber == 0 && exception.LinePosition == 0) {
         details = GetSchemaItem(source, null, message);
     }
     else {
         string ns = null;
         if (source != null) {
             while (source.Parent != null) {
                 source = source.Parent;
             }
             if (source is XmlSchema) {
                 ns = ((XmlSchema)source).TargetNamespace;
             }
         }
         details = Res.GetString(Res.SchemaSyntaxErrorDetails, ns, message, exception.LineNumber, exception.LinePosition);
     }
     return details;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:20,代码来源:SchemaCompiler.cs


示例5: RaiseValidationEvent

		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)
			{
				if (e.Severity == XmlSeverityType.Error)
					throw e.Exception;
			}
			else
			{
				handle(sender,e);
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:21,代码来源:ValidationHandler.cs


示例6: ProcessEntity

        protected static void ProcessEntity(SchemaInfo sinfo, string name, IValidationEventHandling eventHandling, string baseUriStr, int lineNumber, int linePosition) {
            SchemaEntity en;
            string errorResId = null;
            if (!sinfo.GeneralEntities.TryGetValue(new XmlQualifiedName(name), out en)) {
                // validation error, see xml spec [68]
                errorResId = Res.Sch_UndeclaredEntity;

            }
            else if (en.NData.IsEmpty) {
                errorResId = Res.Sch_UnparsedEntityRef;
            }
            if (errorResId != null) {
                XmlSchemaException e = new XmlSchemaException(errorResId, name, baseUriStr, lineNumber, linePosition);

                if (eventHandling != null) {
                    eventHandling.SendEvent(e, XmlSeverityType.Error);
                }
                else {
                    throw e;
                }
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:22,代码来源:BaseValidator.cs


示例7: SendValidationEvent

 protected void SendValidationEvent(XmlSchemaException e, XmlSeverityType severity) {
     if (eventHandling != null) {
         eventHandling.SendEvent(e, severity);
     }
     else if (severity == XmlSeverityType.Error) {
         throw e;
     }
 }
开发者ID:uQr,项目名称:referencesource,代码行数:8,代码来源:BaseValidator.cs


示例8: SendValidationEvent

 private void SendValidationEvent(XmlSchemaException e) {
     if (validationEventHandler != null) {
         validationEventHandler(this, new ValidationEventArgs(e));
     } 
     else {
         throw e;
     }
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:8,代码来源:xmlschemacollection.cs


示例9: DtdParserProxy_SendValidationEvent

 internal void DtdParserProxy_SendValidationEvent( XmlSeverityType severity, XmlSchemaException exception ) {
     if ( DtdValidation ) {
         this.SendValidationEvent( severity, exception );
     }
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:5,代码来源:xmltextreaderimpl.cs


示例10: SendValidationEvent

 private void SendValidationEvent(XmlSchemaException e) {
     SendValidationEvent(e, XmlSeverityType.Error);
 }
开发者ID:uQr,项目名称:referencesource,代码行数:3,代码来源:XsdBuilder.cs


示例11: SendValidationEvent

 private void SendValidationEvent(XmlSchemaException e, XmlSeverityType severity)
 {
     _SchemaInfo.ErrorCount++;
     if (_validationEventHandler != null)
     {
         _validationEventHandler(this, new ValidationEventArgs(e, severity));
     }
     else if (severity == XmlSeverityType.Error)
     {
         throw e;
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:12,代码来源:XdrBuilder.cs


示例12: PermitOnlySerializationFormatter_GetObjectData

		public void PermitOnlySerializationFormatter_GetObjectData ()
		{
			StreamingContext sc = new StreamingContext (StreamingContextStates.All);
			XmlSchemaException xe = new XmlSchemaException (String.Empty, null);
			xe.GetObjectData (null, sc);
		}
开发者ID:xzkmxd,项目名称:mono,代码行数:6,代码来源:XmlSchemaExceptionCas.cs


示例13: SendValidationEvent

 private void SendValidationEvent(XmlSchemaException e, XmlSeverityType severity) {
     if (validationEventHandler != null) {
         validationEventHandler(null, new ValidationEventArgs(e, severity));
     }
     else if (severity == XmlSeverityType.Error) {
         throw e;
     }
 }
开发者ID:ArildF,项目名称:masters,代码行数:8,代码来源:validator.cs


示例14: CheckDefaultValue

        internal static void CheckDefaultValue(
            string              value,
            SchemaAttDef        attdef,
            SchemaInfo          sinfo,
            XmlNamespaceManager     nsManager,
            XmlNameTable        nameTable,
            object              sender,
            ValidationEventHandler  eventhandler
        ) {
#if DEBUG
            Debug.WriteLineIf(CompModSwitches.XmlSchema.TraceVerbose, string.Format("Validator.CheckDefaultValue(\"{0}\")", value));
#endif
            try {

                XmlSchemaDatatype dtype = attdef.Datatype;
                if (dtype == null) {
                    return; // no reason to check
                }
                if (sinfo.SchemaType != SchemaType.XSD) {
                    if (dtype.TokenizedType != XmlTokenizedType.CDATA) {
                        value = value.Trim();
                    }
                    if (sinfo.SchemaType == SchemaType.XDR && value == string.Empty) {
                        return; // don't need to check
                    }
                }

                object typedValue = dtype.ParseValue(value, nameTable, nsManager);

                // Check special types
                XmlTokenizedType ttype = dtype.TokenizedType;
                if (ttype == XmlTokenizedType.ENTITY) {
                    if (dtype.Variety == XmlSchemaDatatypeVariety.List) {
                        string[] ss = (string[])typedValue;
                        foreach(string s in ss) {
                            ProcessEntity(sinfo, s, sender, eventhandler);
                        }
                    }
                    else {
                        ProcessEntity(sinfo, (string)typedValue, sender, eventhandler);
                    }
                }
                else if (ttype == XmlTokenizedType.ENUMERATION) {
                    if (!attdef.CheckEnumeration(typedValue)) {
                        XmlSchemaException e = new XmlSchemaException(Res.Sch_EnumerationValue, typedValue.ToString());
                        if (eventhandler != null) {
                            eventhandler(sender, new ValidationEventArgs(e));
                        }
                        else {
                            throw e;
                        }
                    }
                }
                attdef.DefaultValueTyped = typedValue;
            }
#if DEBUG
            catch (XmlSchemaException ex) {
                Debug.WriteLineIf(CompModSwitches.XmlSchema.TraceError, ex.Message);
#else
            catch  {
#endif
                XmlSchemaException e = new XmlSchemaException(Res.Sch_AttributeDefaultDataType, attdef.Name.ToString());
                if (eventhandler != null) {
                    eventhandler(sender, new ValidationEventArgs(e));
                }
                else {
                    throw e;
                }
            }
        }
开发者ID:ArildF,项目名称:masters,代码行数:70,代码来源:validator.cs


示例15: FormatPosition

 private string FormatPosition(XmlSchemaException xmlSchemaException)
 {
     return string.Format(" @ line:{0} column:{1}", xmlSchemaException.LineNumber, xmlSchemaException.LinePosition);
 }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:4,代码来源:ConfigurationValidator.cs


示例16: SetDefaultTypedValue

 public static void SetDefaultTypedValue(SchemaAttDef attdef, IDtdParserAdapter readerAdapter)
 {
     try
     {
         string defaultValueExpanded = attdef.DefaultValueExpanded;
         XmlSchemaDatatype datatype = attdef.Datatype;
         if (datatype != null)
         {
             if (datatype.TokenizedType != XmlTokenizedType.CDATA)
             {
                 defaultValueExpanded = defaultValueExpanded.Trim();
             }
             attdef.DefaultValueTyped = datatype.ParseValue(defaultValueExpanded, readerAdapter.NameTable, readerAdapter.NamespaceResolver);
         }
     }
     catch (Exception)
     {
         IValidationEventHandling validationEventHandling = ((IDtdParserAdapterWithValidation) readerAdapter).ValidationEventHandling;
         if (validationEventHandling != null)
         {
             XmlSchemaException exception = new XmlSchemaException("Sch_AttributeDefaultDataType", attdef.Name.ToString());
             validationEventHandling.SendEvent(exception, XmlSeverityType.Error);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:DtdValidator.cs


示例17: SendValidationEvent

 void SendValidationEvent( XmlSeverityType severity, XmlSchemaException exception ) {
     if ( validationEventHandler != null ) {
         validationEventHandler( this, new ValidationEventArgs( exception, severity ) );
     }
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:5,代码来源:xmltextreaderimpl.cs


示例18: SendValidationEvent

 private void SendValidationEvent(XmlSchemaException e)
 {
     this.SendValidationEvent(new XmlSchemaValidationException(e.GetRes, e.Args, e.SourceUri, e.LineNumber, e.LinePosition), XmlSeverityType.Error);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:XmlSchemaValidator.cs


示例19: SendValidationEvent

 private void SendValidationEvent(XmlSeverityType severity, XmlSchemaException exception)
 {
     if (_validationEventHandling != null)
     {
         _validationEventHandling.SendEvent(exception, severity);
     }
 }
开发者ID:chcosta,项目名称:corefx,代码行数:7,代码来源:XmlTextReaderImpl.cs


示例20: TryParseValue

        internal override Exception TryParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, out object typedValue) {
            Exception exception;
            XmlSchemaSimpleType memberType = null;

            typedValue = null;

            exception = unionFacetsChecker.CheckLexicalFacets(ref s, this);
            if (exception != null) goto Error;

            //Parse string to CLR value
            for (int i = 0; i < types.Length; ++i) {
                exception = types[i].Datatype.TryParseValue(s, nameTable, nsmgr, out typedValue);
                if (exception == null) {
                    memberType = types[i];
                    break;
                }
            }
            if (memberType == null) {
                exception = new XmlSchemaException(Res.Sch_UnionFailedEx, s);
                goto Error;
            }

            typedValue = new XsdSimpleValue(memberType, typedValue);
            exception = unionFacetsChecker.CheckValueFacets(typedValue, this);
            if (exception != null) goto Error;

            return null;

        Error:
            return exception;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:31,代码来源:DataTypeImplementation.cs



注:本文中的System.Xml.Schema.XmlSchemaException类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Schema.XmlSchemaFacet类代码示例发布时间:2022-05-26
下一篇:
C# Schema.XmlSchemaElement类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap