當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。