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

C# Schema.XdrBuilder类代码示例

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

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



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


示例16: XDR_BuildRoot_Name

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


示例17: XDR_BuildRoot_ID

 private static void XDR_BuildRoot_ID(XdrBuilder builder, object obj, string prefix)
 {
 }
开发者ID:dotnet,项目名称:corefx,代码行数:3,代码来源:XdrBuilder.cs


示例18: XDR_EndAttributeDtType

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

            if (!builder._AttributeDef._HasDataType)
            {
                code = SR.Sch_MissAttribute;
            }
            else
            {
                if (builder._AttributeDef._AttDef.Datatype != null)
                {
                    XmlTokenizedType ttype = builder._AttributeDef._AttDef.Datatype.TokenizedType;

                    if (ttype == XmlTokenizedType.ENUMERATION && !builder._AttributeDef._EnumerationRequired)
                    {
                        code = SR.Sch_MissDtvaluesAttribute;
                    }
                    else if (ttype != XmlTokenizedType.ENUMERATION && builder._AttributeDef._EnumerationRequired)
                    {
                        code = SR.Sch_RequireEnumeration;
                    }
                }
            }
            if (code != null)
            {
                builder.SendValidationEvent(code);
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:29,代码来源:XdrBuilder.cs


示例19: XDR_EndRoot

        private static void XDR_EndRoot(XdrBuilder builder)
        {
            //
            // check undefined attribute types
            // We already checked local attribute types, so only need to check global attribute types here 
            //
            while (builder._UndefinedAttributeTypes != null)
            {
                XmlQualifiedName gname = builder._UndefinedAttributeTypes._TypeName;

                // if there is no URN in this name then the name is local to the
                // schema, but the global attribute was still URN qualified, so
                // we need to qualify this name now.
                if (gname.Namespace.Length == 0)
                {
                    gname = new XmlQualifiedName(gname.Name, builder._TargetNamespace);
                }
                SchemaAttDef ad;
                if (builder._SchemaInfo.AttributeDecls.TryGetValue(gname, out ad))
                {
                    builder._UndefinedAttributeTypes._Attdef = (SchemaAttDef)ad.Clone();
                    builder._UndefinedAttributeTypes._Attdef.Name = gname;
                    builder.XDR_CheckAttributeDefault(builder._UndefinedAttributeTypes, builder._UndefinedAttributeTypes._Attdef);
                }
                else
                {
                    builder.SendValidationEvent(SR.Sch_UndeclaredAttribute, gname.Name);
                }
                builder._UndefinedAttributeTypes = builder._UndefinedAttributeTypes._Next;
            }

            foreach (SchemaElementDecl ed in builder._UndeclaredElements.Values)
            {
                builder.SendValidationEvent(SR.Sch_UndeclaredElement, XmlQualifiedName.ToString(ed.Name.Name, ed.Prefix));
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:36,代码来源:XdrBuilder.cs


示例20: IsYes

        private static bool IsYes(object obj, XdrBuilder builder)
        {
            XmlQualifiedName qname = (XmlQualifiedName)obj;
            bool fYes = false;

            if (qname.Name == "yes")
            {
                fYes = true;
            }
            else if (qname.Name != "no")
            {
                builder.SendValidationEvent(SR.Sch_UnknownRequired);
            }

            return fYes;
        }
开发者ID:dotnet,项目名称:corefx,代码行数:16,代码来源:XdrBuilder.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Schema.XmlSchema类代码示例发布时间:2022-05-26
下一篇:
C# Schema.ValidationState类代码示例发布时间: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