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


C# Schema.XdrBuilder类代码示例

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


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

示例1: StartParsingAsync

        public async Task StartParsingAsync(XmlReader reader, string targetNamespace) {
            this.reader = reader;
            positionInfo = PositionInfo.GetPositionInfo(reader);
            namespaceManager = reader.NamespaceManager;
            if (namespaceManager == null) {
                namespaceManager = new XmlNamespaceManager(nameTable);
                isProcessNamespaces = true;
            } 
            else {
                isProcessNamespaces = false;
            }
            while (reader.NodeType != XmlNodeType.Element && await reader.ReadAsync().ConfigureAwait(false)) {}

            markupDepth = int.MaxValue;
            schemaXmlDepth = reader.Depth;
            SchemaType rootType = schemaNames.SchemaTypeFromRoot(reader.LocalName, reader.NamespaceURI);
            
            string code;
            if (!CheckSchemaRoot(rootType, out code)) {
                throw new XmlSchemaException(code, reader.BaseURI, positionInfo.LineNumber, positionInfo.LinePosition);
            }
            
            if (schemaType == SchemaType.XSD) {
                schema = new XmlSchema();
                schema.BaseUri = new Uri(reader.BaseURI, UriKind.RelativeOrAbsolute);
                builder = new XsdBuilder(reader, namespaceManager, schema, nameTable, schemaNames, eventHandler);
            }
            else {  
                Debug.Assert(schemaType == SchemaType.XDR);
                xdrSchema = new SchemaInfo();
                xdrSchema.SchemaType = SchemaType.XDR;
                builder = new XdrBuilder(reader, namespaceManager, xdrSchema, targetNamespace, nameTable, schemaNames, eventHandler);
                ((XdrBuilder)builder).XmlResolver = xmlResolver;
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:35,代码来源:ParserAsync.cs

示例2: XDR_EndAttribute

 private static void XDR_EndAttribute(XdrBuilder builder)
 {
     builder._BaseDecl.Reset();
 }
开发者ID:dotnet,项目名称:corefx,代码行数:4,代码来源:XdrBuilder.cs

示例3: XDR_BeginElementType

        private static void XDR_BeginElementType(XdrBuilder builder)
        {
            string code = null;
            string msg = null;

            //
            // check name attribute
            //
            if (builder._ElementDef._ElementDecl.Name.IsEmpty)
            {
                code = SR.Sch_MissAttribute;
                msg = "name";
                goto cleanup;
            }

            //
            // check dt:type attribute
            //
            if (builder._ElementDef._HasDataType)
            {
                if (!builder._ElementDef._AllowDataType)
                {
                    code = SR.Sch_DataTypeTextOnly;
                    goto cleanup;
                }
                else
                {
                    builder._ElementDef._ContentAttr = SchemaContentText;
                }
            }
            else if (builder._ElementDef._ContentAttr == SchemaContentNone)
            {
                switch (builder._ElementDef._OrderAttr)
                {
                    case SchemaOrderNone:
                        builder._ElementDef._ContentAttr = SchemaContentMixed;
                        builder._ElementDef._OrderAttr = SchemaOrderMany;
                        break;
                    case SchemaOrderSequence:
                        builder._ElementDef._ContentAttr = SchemaContentElement;
                        break;
                    case SchemaOrderChoice:
                        builder._ElementDef._ContentAttr = SchemaContentElement;
                        break;
                    case SchemaOrderMany:
                        builder._ElementDef._ContentAttr = SchemaContentMixed;
                        break;
                }
            }


            //save the model value from the base
            bool tempOpen = builder._contentValidator.IsOpen;
            ElementContent def = builder._ElementDef;
            switch (builder._ElementDef._ContentAttr)
            {
                case SchemaContentText:
                    builder._ElementDef._ElementDecl.ContentValidator = ContentValidator.TextOnly;
                    builder._GroupDef._Order = SchemaOrderMany;
                    builder._contentValidator = null;
                    break;
                case SchemaContentElement:
                    builder._contentValidator = new ParticleContentValidator(XmlSchemaContentType.ElementOnly);
                    if (def._OrderAttr == SchemaOrderNone)
                    {
                        builder._GroupDef._Order = SchemaOrderSequence;
                    }
                    def._MasterGroupRequired = true;
                    builder._contentValidator.IsOpen = tempOpen;
                    break;

                case SchemaContentEmpty:
                    builder._ElementDef._ElementDecl.ContentValidator = ContentValidator.Empty;
                    builder._contentValidator = null;
                    break;

                case SchemaContentMixed:
                    if (def._OrderAttr == SchemaOrderNone || def._OrderAttr == SchemaOrderMany)
                    {
                        builder._GroupDef._Order = SchemaOrderMany;
                    }
                    else
                    {
                        code = SR.Sch_MixedMany;
                        goto cleanup;
                    }
                    def._MasterGroupRequired = true;
                    builder._contentValidator.IsOpen = tempOpen;
                    break;
            }


            if (def._ContentAttr == SchemaContentMixed || def._ContentAttr == SchemaContentElement)
            {
                builder._contentValidator.Start();
                builder._contentValidator.OpenGroup();
            }
        cleanup:
            if (code != null)
            {
//.........这里部分代码省略.........
开发者ID:dotnet,项目名称:corefx,代码行数:101,代码来源:XdrBuilder.cs

示例4: XDR_BuildElementType_DtValues

 private static void XDR_BuildElementType_DtValues(XdrBuilder builder, object obj, string prefix)
 {
     builder._ElementDef._EnumerationRequired = true;
     builder._ElementDef._ElementDecl.Values = new List<string>((string[])obj);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:5,代码来源:XdrBuilder.cs

示例5: XDR_BuildElementType_Order

 private static void XDR_BuildElementType_Order(XdrBuilder builder, object obj, string prefix)
 {
     builder._ElementDef._OrderAttr = builder._GroupDef._Order = builder.GetOrder((XmlQualifiedName)obj);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:4,代码来源:XdrBuilder.cs

示例6: XDR_BuildElementType_Content

 private static void XDR_BuildElementType_Content(XdrBuilder builder, object obj, string prefix)
 {
     builder._ElementDef._ContentAttr = builder.GetContent((XmlQualifiedName)obj);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:4,代码来源:XdrBuilder.cs

示例7: XDR_InitElementType

        //
        // XDR ElementType
        //

        private static void XDR_InitElementType(XdrBuilder builder, object obj)
        {
            builder._ElementDef._ElementDecl = new SchemaElementDecl();
            builder._contentValidator = new ParticleContentValidator(XmlSchemaContentType.Mixed);
            builder._contentValidator.IsOpen = true;

            builder._ElementDef._ContentAttr = SchemaContentNone;
            builder._ElementDef._OrderAttr = SchemaOrderNone;
            builder._ElementDef._MasterGroupRequired = false;
            builder._ElementDef._ExistTerminal = false;
            builder._ElementDef._AllowDataType = true;
            builder._ElementDef._HasDataType = false;
            builder._ElementDef._EnumerationRequired = false;
            builder._ElementDef._AttDefList = new Hashtable();
            builder._ElementDef._MaxLength = uint.MaxValue;
            builder._ElementDef._MinLength = uint.MaxValue;

            //        builder._AttributeDef._HasDataType = false;
            //        builder._AttributeDef._Default = null;
        }
开发者ID:dotnet,项目名称:corefx,代码行数:24,代码来源:XdrBuilder.cs

示例8: XDR_BeginRoot

 private static void XDR_BeginRoot(XdrBuilder builder)
 {
     if (builder._TargetNamespace == null)
     { // inline xdr schema
         if (builder._XdrName != null)
         {
             builder._TargetNamespace = builder._NameTable.Add("x-schema:#" + builder._XdrName);
         }
         else
         {
             builder._TargetNamespace = String.Empty;
         }
     }
     builder._SchemaInfo.TargetNamespaces.Add(builder._TargetNamespace, true);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:15,代码来源:XdrBuilder.cs

示例9: XDR_InitAttributeDtType

 private static void XDR_InitAttributeDtType(XdrBuilder builder, object obj)
 {
     if (builder._AttributeDef._HasDataType)
     {
         builder.SendValidationEvent(SR.Sch_DupDtType);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:XdrBuilder.cs

示例10: XDR_EndElementDtType

 private static void XDR_EndElementDtType(XdrBuilder builder)
 {
     if (!builder._ElementDef._HasDataType)
     {
         builder.SendValidationEvent(SR.Sch_MissAttribute);
     }
     builder._ElementDef._ElementDecl.ContentValidator = ContentValidator.TextOnly;
     builder._ElementDef._ContentAttr = SchemaContentText;
     builder._ElementDef._MasterGroupRequired = false;
     builder._contentValidator = null;
 }
开发者ID:dotnet,项目名称:corefx,代码行数:11,代码来源:XdrBuilder.cs

示例11: XDR_InitElementDtType

        //
        // DataType
        //

        private static void XDR_InitElementDtType(XdrBuilder builder, object obj)
        {
            if (builder._ElementDef._HasDataType)
            {
                builder.SendValidationEvent(SR.Sch_DupDtType);
            }

            if (!builder._ElementDef._AllowDataType)
            {
                builder.SendValidationEvent(SR.Sch_DataTypeTextOnly);
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:16,代码来源:XdrBuilder.cs

示例12: XDR_EndGroup

        //    private static void XDR_BeginGroup(XdrBuilder builder)
        //    {
        //
        //    }


        private static void XDR_EndGroup(XdrBuilder builder)
        {
            if (!builder._ElementDef._ExistTerminal)
            {
                builder.SendValidationEvent(SR.Sch_ElementMissing);
            }

            builder._contentValidator.CloseGroup();

            if (builder._GroupDef._Order == SchemaOrderMany)
            {
                builder._contentValidator.AddStar();
            }

            if (SchemaOrderMany == builder._GroupDef._Order &&
                builder._GroupDef._HasMaxAttr &&
                builder._GroupDef._MaxVal != uint.MaxValue)
            {
                builder.SendValidationEvent(SR.Sch_ManyMaxOccurs);
            }

            HandleMinMax(builder._contentValidator,
                         builder._GroupDef._MinVal,
                         builder._GroupDef._MaxVal);

            builder.PopGroupInfo();
        }
开发者ID:dotnet,项目名称:corefx,代码行数:33,代码来源:XdrBuilder.cs

示例13: XDR_BuildGroup_MaxOccurs

 private static void XDR_BuildGroup_MaxOccurs(XdrBuilder builder, object obj, string prefix)
 {
     builder._GroupDef._MaxVal = ParseMaxOccurs(obj, builder);
     builder._GroupDef._HasMaxAttr = true;
 }
开发者ID:dotnet,项目名称:corefx,代码行数:5,代码来源:XdrBuilder.cs

示例14: XDR_BuildGroup_Order

 private static void XDR_BuildGroup_Order(XdrBuilder builder, object obj, string prefix)
 {
     builder._GroupDef._Order = builder.GetOrder((XmlQualifiedName)obj);
     if (builder._ElementDef._ContentAttr == SchemaContentMixed && builder._GroupDef._Order != SchemaOrderMany)
     {
         builder.SendValidationEvent(SR.Sch_MixedMany);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:8,代码来源:XdrBuilder.cs

示例15: XDR_InitGroup

        //
        // XDR Group
        //

        private static void XDR_InitGroup(XdrBuilder builder, object obj)
        {
            if (builder._ElementDef._ContentAttr == SchemaContentEmpty ||
                builder._ElementDef._ContentAttr == SchemaContentText)
            {
                builder.SendValidationEvent(SR.Sch_GroupDisabled);
            }

            builder.PushGroupInfo();

            builder._GroupDef._MinVal = 1;
            builder._GroupDef._MaxVal = 1;
            builder._GroupDef._HasMaxAttr = false;
            builder._GroupDef._HasMinAttr = false;

            if (builder._ElementDef._ExistTerminal)
                builder.AddOrder();

            // now we are in a group so we reset fExistTerminal
            builder._ElementDef._ExistTerminal = false;

            builder._contentValidator.OpenGroup();
        }
开发者ID:dotnet,项目名称:corefx,代码行数:27,代码来源:XdrBuilder.cs


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