Unescape() private static method

private static Unescape ( string str ) : string
str string
return string
Example #1
0
        internal string SearchForTextOfLocalName(string strLocalName)
        {
            if (strLocalName == null)
            {
                throw new ArgumentNullException("strLocalName");
            }
            if (this.m_strTag == null)
            {
                return(null);
            }
            if (this.m_strTag.Equals(strLocalName) || this.m_strTag.EndsWith(":" + strLocalName, StringComparison.Ordinal))
            {
                return(SecurityElement.Unescape(this.m_strText));
            }
            if (this.m_lChildren == null)
            {
                return(null);
            }
            IEnumerator enumerator = this.m_lChildren.GetEnumerator();

            while (enumerator.MoveNext())
            {
                string text = ((SecurityElement)enumerator.Current).SearchForTextOfLocalName(strLocalName);
                if (text != null)
                {
                    return(text);
                }
            }
            return(null);
        }
Example #2
0
        /// <summary>根据标记名查找子级并返回所包含的文本。</summary>
        /// <returns>具有指定标记值的第一个子元素的文本内容。</returns>
        /// <param name="tag">要在子元素中搜索的标记。</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="tag" /> 为 null。</exception>
        public string SearchForTextOfTag(string tag)
        {
            if (tag == null)
            {
                throw new ArgumentNullException("tag");
            }
            if (string.Equals(this.m_strTag, tag))
            {
                return(SecurityElement.Unescape(this.m_strText));
            }
            if (this.m_lChildren == null)
            {
                return((string)null);
            }
            IEnumerator enumerator = this.m_lChildren.GetEnumerator();

            this.ConvertSecurityElementFactories();
            while (enumerator.MoveNext())
            {
                string str = ((SecurityElement)enumerator.Current).SearchForTextOfTag(tag);
                if (str != null)
                {
                    return(str);
                }
            }
            return((string)null);
        }
Example #3
0
 internal string SearchForTextOfLocalName(string strLocalName)
 {
     if (strLocalName == null)
     {
         throw new ArgumentNullException("strLocalName");
     }
     if (this.m_strTag == null)
     {
         return((string)null);
     }
     if (this.m_strTag.Equals(strLocalName) || this.m_strTag.EndsWith(":" + strLocalName, StringComparison.Ordinal))
     {
         return(SecurityElement.Unescape(this.m_strText));
     }
     if (this.m_lChildren == null)
     {
         return((string)null);
     }
     foreach (SecurityElement mLChild in this.m_lChildren)
     {
         string str = mLChild.SearchForTextOfLocalName(strLocalName);
         if (str != null)
         {
             return(str);
         }
     }
     return((string)null);
 }
 public SecurityAttribute(string name, string value)
 {
     if (!SecurityElement.IsValidAttributeName(name))
     {
         throw new ArgumentException(Locale.GetText("Invalid XML attribute name") + ": " + name);
     }
     if (!SecurityElement.IsValidAttributeValue(value))
     {
         throw new ArgumentException(Locale.GetText("Invalid XML attribute value") + ": " + value);
     }
     this._name  = name;
     this._value = SecurityElement.Unescape(value);
 }
Example #5
0
        /// <summary>Finds an attribute by name in an XML element.</summary>
        /// <returns>The value associated with the named attribute, or null if no attribute with <paramref name="name" /> exists.</returns>
        /// <param name="name">The name of the attribute for which to search. </param>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
        public string Attribute(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (this.m_lAttributes == null)
            {
                return(null);
            }
            int count = this.m_lAttributes.Count;

            for (int i = 0; i < count; i += 2)
            {
                string a = (string)this.m_lAttributes[i];
                if (string.Equals(a, name))
                {
                    string str = (string)this.m_lAttributes[i + 1];
                    return(SecurityElement.Unescape(str));
                }
            }
            return(null);
        }
Example #6
0
        /// <summary>根据名称在 XML 元素中查找特性。</summary>
        /// <returns>与命名特性相关的值,或者,如果不存在与 <paramref name="name" /> 相关的特性,则为 null。</returns>
        /// <param name="name">要搜索的特性名。</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="name" /> 参数为 null。</exception>
        public string Attribute(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (this.m_lAttributes == null)
            {
                return((string)null);
            }
            int count = this.m_lAttributes.Count;
            int index = 0;

            while (index < count)
            {
                if (string.Equals((string)this.m_lAttributes[index], name))
                {
                    return(SecurityElement.Unescape((string)this.m_lAttributes[index + 1]));
                }
                index += 2;
            }
            return((string)null);
        }