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


C# XmlNode.GetOptionalAttribute方法代码示例

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


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

示例1: Parse

        /// <summary>
        /// Parses the condition.
        /// </summary>
        /// <param name="node">The node to parse.</param>
        /// <returns>The condition parsed, or null if nothing parsed.</returns>
        public IRewriteCondition Parse(XmlNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            string method = node.GetOptionalAttribute(Constants.AttrMethod);
            if (method == null)
            {
                return null;
            }

            return new MethodCondition(method);
        }
开发者ID:Thesykan,项目名称:urlrewriter,代码行数:20,代码来源:MethodConditionParser.cs

示例2: Parse

        /// <summary>
        /// Parses the condition.
        /// </summary>
        /// <param name="node">The node to parse.</param>
        /// <returns>The condition parsed, or null if nothing parsed.</returns>
        public IRewriteCondition Parse(XmlNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            string exists = node.GetOptionalAttribute(Constants.AttrExists);
            if (exists == null)
            {
                return null;
            }

            return new ExistsCondition(exists);
        }
开发者ID:Thesykan,项目名称:urlrewriter,代码行数:20,代码来源:ExistsConditionParser.cs

示例3: Parse

        /// <summary>
        /// Parses the condition.
        /// </summary>
        /// <param name="node">The node to parse.</param>
        /// <returns>The condition parsed, or null if nothing parsed.</returns>
        public IRewriteCondition Parse(XmlNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            string urlPattern = node.GetOptionalAttribute(Constants.AttrUrl);
            if (urlPattern == null)
            {
                return null;
            }

            return new UrlMatchCondition(urlPattern);
        }
开发者ID:Thesykan,项目名称:urlrewriter,代码行数:20,代码来源:UrlMatchConditionParser.cs

示例4: Parse

        /// <summary>
        /// Parses the condition.
        /// </summary>
        /// <param name="node">The node to parse.</param>
        /// <returns>The condition parsed, or null if nothing parsed.</returns>
        public IRewriteCondition Parse(XmlNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            string header = node.GetOptionalAttribute(Constants.AttrHeader);
            if (header == null)
            {
                return null;
            }

            string match = node.GetRequiredAttribute(Constants.AttrMatch, true);
            return new PropertyMatchCondition(header, match);
        }
开发者ID:Thesykan,项目名称:urlrewriter,代码行数:21,代码来源:HeaderMatchConditionParser.cs

示例5: Parse

        /// <summary>
        /// Parses the node.
        /// </summary>
        /// <param name="node">The node to parse.</param>
        /// <param name="config">The rewriter configuration.</param>
        /// <returns>The parsed action, or null if no action parsed.</returns>
        public override IRewriteAction Parse(XmlNode node, IRewriterConfiguration config)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            string headerName = node.GetOptionalAttribute(Constants.AttrHeader);
            if (headerName == null)
            {
                return null;
            }

            string headerValue = node.GetRequiredAttribute(Constants.AttrValue, true);

            return new AddHeaderAction(headerName, headerValue);
        }
开发者ID:Thesykan,项目名称:urlrewriter,代码行数:27,代码来源:AddHeaderActionParser.cs

示例6: Parse

        /// <summary>
        /// Parses the node.
        /// </summary>
        /// <param name="node">The node to parse.</param>
        /// <param name="config">The rewriter configuration.</param>
        /// <returns>The parsed action, or null if no action parsed.</returns>
        public override IRewriteAction Parse(XmlNode node, IRewriterConfiguration config)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            string cookieName = node.GetOptionalAttribute(Constants.AttrCookie);
            if (String.IsNullOrEmpty(cookieName))
            {
                return null;
            }

            string cookieValue = node.GetRequiredAttribute(Constants.AttrValue, true);

            return new SetCookieAction(cookieName, cookieValue);
        }
开发者ID:Thesykan,项目名称:urlrewriter,代码行数:27,代码来源:SetCookieActionParser.cs

示例7: ParseProcessing

        private RewriteProcessing ParseProcessing(XmlNode node)
        {
            string processing = node.GetOptionalAttribute(Constants.AttrProcessing);
            if (processing == null)
            {
                // Default to ContinueProcessing if processing attribute is missing.
                return RewriteProcessing.ContinueProcessing;
            }

            switch (processing)
            {
                case Constants.AttrValueRestart:
                    return RewriteProcessing.RestartProcessing;

                case Constants.AttrValueStop:
                    return RewriteProcessing.StopProcessing;

                case Constants.AttrValueContinue:
                    return RewriteProcessing.ContinueProcessing;

                default:
                    throw new ConfigurationErrorsException(MessageProvider.FormatString(Message.ValueOfProcessingAttribute, processing, Constants.AttrValueContinue, Constants.AttrValueRestart, Constants.AttrValueStop), node);
            }
        }
开发者ID:Thesykan,项目名称:urlrewriter,代码行数:24,代码来源:RewriteActionParser.cs


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