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


C# XmlReader.ReadElementContentAsBoolean方法代码示例

本文整理汇总了C#中System.Xml.XmlReader.ReadElementContentAsBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadElementContentAsBoolean方法的具体用法?C# XmlReader.ReadElementContentAsBoolean怎么用?C# XmlReader.ReadElementContentAsBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlReader的用法示例。


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

示例1: XmlConfigurator

        private XmlConfigurator(XmlReader reader, SerializationContext context, string sectionName)
        {
            this.reader = reader;
            this.context = context;
            this.sectionName = sectionName;

            handlers["IsCompact"] = delegate() { context.IsCompact = reader.ReadElementContentAsBoolean(); };
            handlers["OutputTypeComment"] = delegate() { context.OutputTypeComment = reader.ReadElementContentAsBoolean(); };
            handlers["OutputTypeInformation"] = delegate() { context.OutputTypeInformation = reader.ReadElementContentAsBoolean(); };
            handlers["ReferenceWritingType"] = new MapHandler(HandleReferenceWritingType);
            handlers["TypeBindings"] = new MapHandler(HandleTypeBindings);
            handlers["TypeConverters"] = new MapHandler(HandleTypeConverters);
            handlers["CollectionHandlers"] = new MapHandler(HandleCollectionHandlers);
            handlers["IgnoreProperties"] = new MapHandler(HandleIgnoreProperties);
        }
开发者ID:Letractively,项目名称:gabesworkshop,代码行数:15,代码来源:XmlConfigurator.cs

示例2: ReadXml

 public void ReadXml(XmlReader reader)
 {
     while (!reader.EOF)
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case Fb2FixModeElementName:
                     FixOptions fixMode;
                     string elementContent = reader.ReadElementContentAsString();
                     if (!Enum.TryParse(elementContent, true, out fixMode))
                     {
                         throw new InvalidDataException(string.Format("Invalid fix mode: {0}", elementContent));
                     }
                     _fixMode = fixMode;
                     continue;
                 case ConverAlphaChennelElementName:
                     _convertAlphaPng = reader.ReadElementContentAsBoolean();
                     continue;
             }
         }
         reader.Read();
     }
 }
开发者ID:rajeshwarn,项目名称:fb2converters,代码行数:25,代码来源:FB2ImportSettings.cs

示例3: ReadXml

 public void ReadXml(XmlReader reader)
 {
     while (!reader.EOF)
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case TransliterateTOCElementName:
                     _transliterateTOC = reader.ReadElementContentAsBoolean();
                     continue;
                 case FlatFileFolderStructureElementName:
                     _flatFileFolderStructure = reader.ReadElementContentAsBoolean();
                     continue;
                 case EmbedStylesIntoXHTMLElementName:
                     _embeddStyles = reader.ReadElementContentAsBoolean();
                     continue;
                 case GenerateDropCharactersElementName:
                     _capitalDrop = reader.ReadElementContentAsBoolean();
                     continue;
             }
         }
         reader.Read();
     }
 }
开发者ID:rajeshwarn,项目名称:fb2converters,代码行数:25,代码来源:EPubCommonSettings.cs

示例4: ReadXml

 public void ReadXml(XmlReader reader)
 {
     while (!reader.EOF)
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case EPUB3SubVersionElementName:
                     EPubV3SubStandard standard;
                     string elementContent = reader.ReadElementContentAsString();
                     if (!Enum.TryParse(elementContent, true, out standard))
                     {
                         throw new InvalidDataException(string.Format("Invalid epub standard version passed : {0}", elementContent));
                     }
                     _v3SubStandard = standard;
                     continue;
                 case GenerateV2CompatibleTOCElementName:
                     _generateV2CompatibleTOC = reader.ReadElementContentAsBoolean();
                     continue;
                 case HTMLFileMaxSizeAllowedElementName:
                     HTMLFileMaxSize = (ulong)reader.ReadElementContentAsLong();
                     continue;
             }
         }
         reader.Read();
     }
    
 }
开发者ID:npuBug,项目名称:fb2epub,代码行数:29,代码来源:EPubV3Settings.cs

示例5: Todo

 internal Todo(XmlReader rdr)
 {
     rdr.ReadStartElement("todo");
     this.Id = rdr.ReadElementContentAsInt("id", "");
     this.Title = rdr.ReadElementString("title");
     this.Description = rdr.ReadElementString("description");
     this.DueDate = Convert.ToDateTime(rdr.ReadElementString("due_date"));
     this.Flagged = rdr.ReadElementContentAsBoolean("flagged", "");
     this.Complete = rdr.ReadElementContentAsBoolean("complete", "");
     this.AssignedBy = rdr.ReadElementString("assigned_by");
     this.AssignedTo = rdr.ReadElementString("assigned_to");
     this.Participants = Participant.BuildList(rdr);
     this.Tags = Tag.BuildList(rdr);
     this.Comments = MegaComment.BuildList(rdr);
     this.CreatedAt = DateTime.Parse(rdr.ReadElementString("created_at"));
     this.UpdatedAt = DateTime.Parse(rdr.ReadElementString("updated_at"));
     rdr.ReadEndElement();
 }
开发者ID:batchblue,项目名称:batchbook-net,代码行数:18,代码来源:Todo.cs

示例6: ProcessElement

        static void ProcessElement(XmlReader xr)
        {
            if (xr.EOF)
                return;

            string name = xr.GetAttribute("name");
            
            switch (name)
            {
                case "inputpath":
                    inputPath.AddRange(ProcessPathList(xr));
                    break;
                case "libs":
                    libs = ProcessStringList(xr);
                    break;
                case "rununittests":
                    runUnitTests = xr.ReadElementContentAsBoolean();
                    break;
                case "outputgrammar":
                    outputGrammar = xr.ReadElementContentAsBoolean();
                    break;
                case "outputprimitives":
                    outputPrimitives = xr.ReadElementContentAsBoolean();
                    break;
                case "extensions":
                    extensions = ProcessStringList(xr);
                    break;
                case "maxthreads":
                    maxThreads = xr.ReadElementContentAsInt();
                    break;
                case "showtiming":
                    showTiming = xr.ReadElementContentAsBoolean();
                    break;
                case "waitforkeypress":
                    waitForKeypress = xr.ReadElementContentAsBoolean();
                    break;
                case "optimize":
                    optimize = xr.ReadElementContentAsBoolean();
                    break;
                default:
                    throw new Exception("Unrecognized node type '" + name + "'");
            }
        }
开发者ID:catb0t,项目名称:heron-language,代码行数:43,代码来源:HeronConfig.cs

示例7: Read

        /// <summary>
        /// Read a direct payment session request result
        /// </summary>
        /// <param name="streamReader"></param>
        /// <param name="installments"></param>
        internal static void Read(XmlReader reader, Installment installment)
        {
            if (reader.IsEmptyElement)
            {
                XMLParserUtils.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(SerializerHelper.Installment);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (XMLParserUtils.IsEndElement(reader, SerializerHelper.Installment))
                {
                    XMLParserUtils.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                        case SerializerHelper.CreditCardBrand:
                            installment.cardBrand = reader.ReadElementContentAsString();
                            break;

                        case SerializerHelper.Quantity:
                            installment.quantity = reader.ReadElementContentAsInt();
                            break;

                        case SerializerHelper.Amount:
                            installment.amount = reader.ReadElementContentAsDecimal();
                            break;

                        case SerializerHelper.TotalAmount:
                            installment.totalAmount = reader.ReadElementContentAsDecimal();
                            break;

                        case SerializerHelper.InterestFree:
                            installment.interestFree = reader.ReadElementContentAsBoolean();
                            break;

                        default:
                            XMLParserUtils.SkipElement(reader);
                            break;
                    }
                }
                else
                {
                    XMLParserUtils.SkipNode(reader);
                }
            }
        }
开发者ID:couras,项目名称:dotnet,代码行数:59,代码来源:InstallmentSerializer.cs

示例8: ReadXml

        public override void ReadXml(XmlReader reader)
        {
            complexParameters.Clear();
            primitiveParameters.Clear();

            reader.MoveToContent();

            reader.ReadStartElement();

            primitiveParameters.Add("DesiredValueStepSize", reader.ReadElementContentAsDouble());
            primitiveParameters.Add("AllowedOscillationPercentage", reader.ReadElementContentAsDouble());
            primitiveParameters.Add("GenerateSineWaveTestCases", reader.ReadElementContentAsBoolean());
            primitiveParameters.Add("SineFrequency", reader.ReadElementContentAsDouble());

            reader.ReadEndElement();
        }
开发者ID:sac16controllertester,项目名称:ControllerTester,代码行数:16,代码来源:AllowedOscillationFaultModelConfiguration.cs

示例9: ParseXml

        internal static WindowsPhoneStoreServiceAppHwCapabilityNode ParseXml(XmlReader reader)
        {
            var node = new WindowsPhoneStoreServiceAppHwCapabilityNode();

            if (reader.IsEmptyElement)
            {
                reader.Skip();
            }
            else
            {
                reader.ReadStartElement();

                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    switch (reader.Name)
                    {
                        case "requirementType":
                            node.RequirementType = reader.ReadElementContentAsString();
                            break;

                        case "id":
                            node.Id = reader.ReadElementContentAsString();
                            break;

                        case "string":
                            node.Title = reader.ReadElementContentAsString();
                            break;

                        case "required":
                            node.Required = reader.ReadElementContentAsBoolean();
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }

                reader.ReadEndElement();
            }

            return node;
        }
开发者ID:HimanshPal,项目名称:Cimbalino-Toolkit,代码行数:43,代码来源:WindowsPhoneStoreServiceAppHwCapabilityNode.cs

示例10: Location

 internal Location(XmlReader rdr)
 {
     rdr.ReadStartElement("location");
     this.Id = rdr.ReadElementContentAsInt("id", "");
     this.Label = rdr.ReadElementString("label");
     this.IsPrimary = rdr.ReadElementContentAsBoolean("primary", "");
     this.Email = rdr.ReadElementString("email");
     this.Website = rdr.ReadElementString("website");
     this.Phone = rdr.ReadElementString("phone");
     this.Cell = rdr.ReadElementString("cell");
     this.Fax = rdr.ReadElementString("fax");
     this.Street1 = rdr.ReadElementString("street_1");
     this.Street2 = rdr.ReadElementString("street_2");
     this.City = rdr.ReadElementString("city");
     this.State = rdr.ReadElementString("state");
     this.PostalCode = rdr.ReadElementString("postal_code");
     this.Country = rdr.ReadElementString("country");
     rdr.ReadEndElement();
 }
开发者ID:batchblue,项目名称:batchbook-net,代码行数:19,代码来源:Location.cs

示例11: ReadEffect

        private EffectData ReadEffect(XmlReader reader, Counter<string> badTags)
        {
            string identifier = null;
            string name = null;
            string imageName = null;
            bool incapacitate = false;

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "id")
                {
                    identifier = reader.ReadElementContentAsString();
                }
                else if (reader.NodeType == XmlNodeType.Element && reader.Name == "name")
                {
                    name = reader.ReadElementContentAsString();
                }
                else if (reader.NodeType == XmlNodeType.Element && reader.Name == "image_name")
                {
                    imageName = reader.ReadElementContentAsString();
                }
                else if (reader.NodeType == XmlNodeType.Element && reader.Name == "incapacitate")
                {
                    incapacitate = reader.ReadElementContentAsBoolean();
                }
                else if (reader.NodeType == XmlNodeType.Element)
                {
                    badTags.Increment(reader.Name);
                }
                else if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "effect")
                {
                    break;
                }
            }
            return new EffectData(identifier, name, imageName, incapacitate);
        }
开发者ID:jennstubley,项目名称:rpg-game,代码行数:36,代码来源:EffectManager.cs

示例12: FromXml

        public bool FromXml(XmlReader reader)
        {
            if (reader == null || reader.Name != "Cat")
            {
                return false;
            }

            if (reader.Name == "Order" || reader.ReadToDescendant("Order"))
            {
                Order = reader.ReadElementContentAsInt();
            }
            if (reader.Name == "Id" || reader.ReadToNextSibling("Id"))
            {
                Id = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Parent" || reader.ReadToNextSibling("Parent"))
            {
                Parent = reader.ReadElementContentAsString();
            }
            if (reader.Name == "IsLeaf" || reader.ReadToNextSibling("IsLeaf"))
            {
                IsLeaf = reader.ReadElementContentAsBoolean();
            }
            if (reader.Name == "Text" || reader.ReadToNextSibling("Text"))
            {
                Text = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Tips" || reader.ReadToNextSibling("Tips"))
            {
                Tips = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Icon" || reader.ReadToNextSibling("Icon"))
            {
                Icon = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Meta" || reader.ReadToNextSibling("Meta"))
            {
                Meta = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Memo" || reader.ReadToNextSibling("Memo"))
            {
                Memo = reader.ReadElementContentAsString();
            }
            return true;
        }
开发者ID:burstas,项目名称:rmps,代码行数:45,代码来源:Cat.cs

示例13: ParseXml

        internal static MarketplaceAppEntryNode ParseXml(XmlReader reader)
        {
            var node = new MarketplaceAppEntryNode();

            reader.ReadStartElement();

            while (reader.NodeType != XmlNodeType.EndElement)
            {
                switch (reader.Name)
                {
                    case "a:updated":
                        node.Updated = reader.ReadElementContentAsDateTime();
                        break;

                    case "a:title":
                        node.Title = MarketplaceAppContentNode.ParseXml(reader);
                        break;

                    case "a:id":
                        node.Id = reader.ReadElementContentAsUrn();
                        break;

                    case "version":
                        node.Version = reader.ReadElementContentAsString();
                        break;

                    case "payloadId":
                        node.PayloadId = reader.ReadElementContentAsUrn();
                        break;

                    case "skuId":
                        node.SkuId = reader.ReadElementContentAsUrn();
                        break;

                    case "skuLastUpdated":
                        node.SkuLastUpdated = reader.ReadElementContentAsDateTime();
                        break;

                    case "isAvailableInCountry":
                        node.IsAvailableInCountry = reader.ReadElementContentAsBoolean();
                        break;

                    case "isAvailableInStore":
                        node.IsAvailableInStore = reader.ReadElementContentAsBoolean();
                        break;

                    case "isClientTypeCompatible":
                        node.IsClientTypeCompatible = reader.ReadElementContentAsBoolean();
                        break;

                    case "isHardwareCompatible":
                        node.IsHardwareCompatible = reader.ReadElementContentAsBoolean();
                        break;

                    case "isBlacklisted":
                        node.IsBlacklisted = reader.ReadElementContentAsBoolean();
                        break;

                    case "url":
                        node.Url = reader.ReadElementContentAsString();
                        break;

                    case "packageSize":
                        node.PackageSize = reader.ReadElementContentAsInt();
                        break;

                    case "installSize":
                        node.InstallSize = reader.ReadElementContentAsInt();
                        break;

                    case "clientTypes":
                        node.ClientTypes = reader.ReadElementContentAsArray(x => x.ReadElementContentAsString());
                        break;

                    case "supportedLanguages":
                        node.SupportedLanguages = reader.ReadElementContentAsArray(x => x.ReadElementContentAsString());
                        break;

                    case "deviceCapabilities":
                        var deviceCapabilitiesString = reader.ReadElementContentAsString();

                        if (!string.IsNullOrEmpty(deviceCapabilitiesString))
                        {
                            deviceCapabilitiesString = string.Format("<root>{0}</root>", HttpUtility.HtmlDecode(deviceCapabilitiesString));

                            using (var stringReader = new StringReader(deviceCapabilitiesString))
                            {
                                using (var reader2 = XmlReader.Create(stringReader))
                                {
                                    reader2.ReadStartElement();

                                    node.DeviceCapabilities = MarketplaceAppCapabilitiesNode.ParseXml(reader2);

                                    reader2.ReadEndElement();
                                }
                            }
                        }
                        break;

                    default:
//.........这里部分代码省略.........
开发者ID:Nearga,项目名称:Cimbalino-Phone-Toolkit,代码行数:101,代码来源:MarketplaceAppEntryNode.cs

示例14: ReadRSTXml


//.........这里部分代码省略.........
                rst.EncryptionAlgorithm = reader.ReadElementContentAsString(trustConstants.Elements.EncryptionAlgorithm, trustConstants.NamespaceURI);
                if (!UriUtil.CanCreateValidUri(rst.EncryptionAlgorithm, UriKind.Absolute))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3135, trustConstants.Elements.EncryptionAlgorithm, trustConstants.NamespaceURI, rst.EncryptionAlgorithm)));
                }
                
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.CanonicalizationAlgorithm, trustConstants.NamespaceURI))
            {
                rst.CanonicalizationAlgorithm = reader.ReadElementContentAsString(trustConstants.Elements.CanonicalizationAlgorithm, trustConstants.NamespaceURI);
                if (!UriUtil.CanCreateValidUri(rst.CanonicalizationAlgorithm, UriKind.Absolute))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3135, trustConstants.Elements.CanonicalizationAlgorithm, trustConstants.NamespaceURI, rst.CanonicalizationAlgorithm)));
                }
                
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.SignatureAlgorithm, trustConstants.NamespaceURI))
            {
                rst.SignatureAlgorithm = reader.ReadElementContentAsString(trustConstants.Elements.SignatureAlgorithm, trustConstants.NamespaceURI);
                if (!UriUtil.CanCreateValidUri(rst.SignatureAlgorithm, UriKind.Absolute))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new WSTrustSerializationException(SR.GetString(SR.ID3135, trustConstants.Elements.SignatureAlgorithm, trustConstants.NamespaceURI, rst.SignatureAlgorithm)));
                }
                
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Forwardable, trustConstants.NamespaceURI))
            {
                rst.Forwardable = reader.ReadElementContentAsBoolean();
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Delegatable, trustConstants.NamespaceURI))
            {
                rst.Delegatable = reader.ReadElementContentAsBoolean();
                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.AllowPostdating, trustConstants.NamespaceURI))
            {
                rst.AllowPostdating = true;
                isEmptyElement = reader.IsEmptyElement;
                reader.Read();
                reader.MoveToContent();
                if (!isEmptyElement)
                {
                    reader.ReadEndElement();
                }

                return;
            }

            if (reader.IsStartElement(trustConstants.Elements.Renewing, trustConstants.NamespaceURI))
            {
                isEmptyElement = reader.IsEmptyElement;
                string attrValue = reader.GetAttribute(trustConstants.Attributes.Allow);
                bool allowRenewal = true;
                bool renewalAfterExpiration = false;
                if (!string.IsNullOrEmpty(attrValue))
                {
                    allowRenewal = XmlConvert.ToBoolean(attrValue);
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:67,代码来源:WSTrustSerializationHelper.cs

示例15: ReadXml

 public override void ReadXml(XmlReader reader)
 {
     Value = reader.ReadElementContentAsBoolean();
 }
开发者ID:OronDF343,项目名称:Sky-Jukebox,代码行数:4,代码来源:BoolProperty.cs


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