当前位置: 首页>>代码示例>>C#>>正文


C# Schema.XmlSchemaDatatype类代码示例

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


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

示例1: CheckValueFacets

 internal override Exception CheckValueFacets(double value, XmlSchemaDatatype datatype)
 {
     RestrictionFacets restriction = datatype.Restriction;
     RestrictionFlags flags = (restriction != null) ? restriction.Flags : ((RestrictionFlags) 0);
     XmlValueConverter valueConverter = datatype.ValueConverter;
     if (((flags & RestrictionFlags.MaxInclusive) != 0) && (value > valueConverter.ToDouble(restriction.MaxInclusive)))
     {
         return new XmlSchemaException("Sch_MaxInclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.MaxExclusive) != 0) && (value >= valueConverter.ToDouble(restriction.MaxExclusive)))
     {
         return new XmlSchemaException("Sch_MaxExclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.MinInclusive) != 0) && (value < valueConverter.ToDouble(restriction.MinInclusive)))
     {
         return new XmlSchemaException("Sch_MinInclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.MinExclusive) != 0) && (value <= valueConverter.ToDouble(restriction.MinExclusive)))
     {
         return new XmlSchemaException("Sch_MinExclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.Enumeration) != 0) && !this.MatchEnumeration(value, restriction.Enumeration, valueConverter))
     {
         return new XmlSchemaException("Sch_EnumerationConstraintFailed", string.Empty);
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:Numeric2FacetsChecker.cs

示例2: CheckValueFacets

 internal override Exception CheckValueFacets(byte[] value, XmlSchemaDatatype datatype)
 {
     RestrictionFacets restriction = datatype.Restriction;
     int length = value.Length;
     RestrictionFlags flags = (restriction != null) ? restriction.Flags : ((RestrictionFlags) 0);
     if (flags != 0)
     {
         if (((flags & RestrictionFlags.Length) != 0) && (restriction.Length != length))
         {
             return new XmlSchemaException("Sch_LengthConstraintFailed", string.Empty);
         }
         if (((flags & RestrictionFlags.MinLength) != 0) && (length < restriction.MinLength))
         {
             return new XmlSchemaException("Sch_MinLengthConstraintFailed", string.Empty);
         }
         if (((flags & RestrictionFlags.MaxLength) != 0) && (restriction.MaxLength < length))
         {
             return new XmlSchemaException("Sch_MaxLengthConstraintFailed", string.Empty);
         }
         if (((flags & RestrictionFlags.Enumeration) != 0) && !this.MatchEnumeration(value, restriction.Enumeration, datatype))
         {
             return new XmlSchemaException("Sch_EnumerationConstraintFailed", string.Empty);
         }
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:BinaryFacetsChecker.cs

示例3: CheckValueFacets

 internal override Exception CheckValueFacets(TimeSpan value, XmlSchemaDatatype datatype)
 {
     RestrictionFacets restriction = datatype.Restriction;
     RestrictionFlags flags = (restriction != null) ? restriction.Flags : ((RestrictionFlags) 0);
     if (((flags & RestrictionFlags.MaxInclusive) != 0) && (TimeSpan.Compare(value, (TimeSpan) restriction.MaxInclusive) > 0))
     {
         return new XmlSchemaException("Sch_MaxInclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.MaxExclusive) != 0) && (TimeSpan.Compare(value, (TimeSpan) restriction.MaxExclusive) >= 0))
     {
         return new XmlSchemaException("Sch_MaxExclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.MinInclusive) != 0) && (TimeSpan.Compare(value, (TimeSpan) restriction.MinInclusive) < 0))
     {
         return new XmlSchemaException("Sch_MinInclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.MinExclusive) != 0) && (TimeSpan.Compare(value, (TimeSpan) restriction.MinExclusive) <= 0))
     {
         return new XmlSchemaException("Sch_MinExclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.Enumeration) != 0) && !this.MatchEnumeration(value, restriction.Enumeration))
     {
         return new XmlSchemaException("Sch_EnumerationConstraintFailed", string.Empty);
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:DurationFacetsChecker.cs

示例4: CheckValueFacets

 internal override Exception CheckValueFacets(object value, XmlSchemaDatatype datatype)
 {
     RestrictionFacets restriction = datatype.Restriction;
     RestrictionFlags flags = (restriction != null) ? restriction.Flags : ((RestrictionFlags) 0);
     if (((flags & RestrictionFlags.Enumeration) != 0) && !this.MatchEnumeration(value, restriction.Enumeration, datatype))
     {
         return new XmlSchemaException("Sch_EnumerationConstraintFailed", string.Empty);
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:UnionFacetsChecker.cs

示例5: MatchEnumeration

 private bool MatchEnumeration(DateTime value, ArrayList enumeration, XmlSchemaDatatype datatype)
 {
     for (int i = 0; i < enumeration.Count; i++)
     {
         if (datatype.Compare(value, (DateTime) enumeration[i]) == 0)
         {
             return true;
         }
     }
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:DateTimeFacetsChecker.cs

示例6: TypedObject

 public TypedObject(object obj, string svalue, XmlSchemaDatatype xsdtype)
 {
     this.ovalue = obj;
     this.svalue = svalue;
     this.xsdtype = xsdtype;
     if (((xsdtype.Variety == XmlSchemaDatatypeVariety.List) || (xsdtype is Datatype_base64Binary)) || (xsdtype is Datatype_hexBinary))
     {
         this.isList = true;
         this.dim = ((Array) obj).Length;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:TypedObject.cs

示例7: GetNewElement

 private XElement GetNewElement(XName name, object value, XmlSchemaDatatype datatype, XElement parentElement) {
     XElement newElement = null;
     if (datatype != null) {
         string stringValue = XTypedServices.GetXmlString(value, datatype, parentElement);
         newElement = new XElement(name, stringValue);
     }
     else {
         newElement = XTypedServices.GetXElement(value as XTypedElement, name);
     }
     return newElement;
 }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:11,代码来源:ContentModel.cs

示例8: MatchEnumeration

 internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype)
 {
     for (int i = 0; i < enumeration.Count; i++)
     {
         if (datatype.Compare(value, enumeration[i]) == 0)
         {
             return true;
         }
     }
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:ListFacetsChecker.cs

示例9: AddElementToParent

 public virtual void AddElementToParent(XName name, object value, XElement parentElement, bool addToExisting, XmlSchemaDatatype datatype) {
     Debug.Assert(value != null);
     if (addToExisting) {
         parentElement.Add(GetNewElement(name, value, datatype, parentElement));
     }
     else {
         XElement existingElement = parentElement.Element(name);
         if (existingElement == null) {
             parentElement.Add(GetNewElement(name, value, datatype, parentElement));
         }
         else if (datatype != null) { //Update simple type value
             existingElement.Value = XTypedServices.GetXmlString(value, datatype, existingElement);
         }
         else {
             existingElement.AddBeforeSelf(XTypedServices.GetXElement(value as XTypedElement, name));
             existingElement.Remove();
         }
     }
 }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:19,代码来源:ContentModel.cs

示例10: ParseFacetValue

 private object ParseFacetValue(XmlSchemaDatatype datatype, XmlSchemaFacet facet, string code, IXmlNamespaceResolver nsmgr, XmlNameTable nameTable) {
     object typedValue;
     Exception ex = datatype.TryParseValue(facet.Value, nameTable, nsmgr, out typedValue);
     if (ex == null) {
         return typedValue;
     }
     else {
         throw new XmlSchemaException(code, new string[] {ex.Message} , ex, facet.SourceUri, facet.LineNumber, facet.LinePosition, facet);
     }
 }
开发者ID:uQr,项目名称:referencesource,代码行数:10,代码来源:FacetChecker.cs

示例11: MatchEnumeration

 internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype) {
     return MatchEnumeration(datatype.ValueConverter.ToDouble(value), enumeration, datatype.ValueConverter);
 }
开发者ID:uQr,项目名称:referencesource,代码行数:3,代码来源:FacetChecker.cs

示例12: CheckValueFacets

 internal override Exception CheckValueFacets(object value, XmlSchemaDatatype datatype) {
     double doubleValue = datatype.ValueConverter.ToDouble(value);
     return CheckValueFacets(doubleValue, datatype);
 }
开发者ID:uQr,项目名称:referencesource,代码行数:4,代码来源:FacetChecker.cs

示例13: CheckLexicalFacets

 internal virtual Exception CheckLexicalFacets(ref string parseString, XmlSchemaDatatype datatype) {
     CheckWhitespaceFacets(ref parseString, datatype);
     return CheckPatternFacets(datatype.Restriction, parseString);
 }
开发者ID:uQr,项目名称:referencesource,代码行数:4,代码来源:FacetChecker.cs

示例14: CheckWhitespaceFacets

        internal void CheckWhitespaceFacets(ref string s, XmlSchemaDatatype datatype) {
            // before parsing, check whitespace facet
            RestrictionFacets restriction = datatype.Restriction;

            switch (datatype.Variety) {
                case XmlSchemaDatatypeVariety.List:
                    s = s.Trim();
                break;

                case XmlSchemaDatatypeVariety.Atomic:
                    if (datatype.BuiltInWhitespaceFacet == XmlSchemaWhiteSpace.Collapse) {
                        s = XmlComplianceUtil.NonCDataNormalize(s);
                    }
                    else if (datatype.BuiltInWhitespaceFacet == XmlSchemaWhiteSpace.Replace) {
                        s = XmlComplianceUtil.CDataNormalize(s);
                    }
                    else if (restriction != null && (restriction.Flags & RestrictionFlags.WhiteSpace) != 0) { //Restriction has whitespace facet specified
                        if (restriction.WhiteSpace == XmlSchemaWhiteSpace.Replace) {
                            s = XmlComplianceUtil.CDataNormalize(s);
                        }
                        else if (restriction.WhiteSpace == XmlSchemaWhiteSpace.Collapse) {
                            s = XmlComplianceUtil.NonCDataNormalize(s);
                        }
                    }
                break;

                default:
                break;

            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:31,代码来源:FacetChecker.cs

示例15: FacetsCompiler

 public FacetsCompiler(DatatypeImplementation baseDatatype, RestrictionFacets restriction) {
     firstPattern = true;
     regStr = null;
     pattern_facet = null;
     datatype = baseDatatype;
     derivedRestriction = restriction;
     baseFlags = datatype.Restriction != null ? datatype.Restriction.Flags : 0;
     baseFixedFlags = datatype.Restriction != null ? datatype.Restriction.FixedFlags : 0;
     validRestrictionFlags = datatype.ValidRestrictionFlags;
     nonNegativeInt = DatatypeImplementation.GetSimpleTypeFromTypeCode(XmlTypeCode.NonNegativeInteger).Datatype;
     builtInEnum = !(datatype is Datatype_union || datatype is Datatype_List) ? datatype.TypeCode : 0;
     builtInType = (int)builtInEnum > 0 ? DatatypeImplementation.GetSimpleTypeFromTypeCode(builtInEnum).Datatype : datatype;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:13,代码来源:FacetChecker.cs


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