IsValidTag() public static method

public static IsValidTag ( string tag ) : bool
tag string
return bool
 /// <summary>Initializes a new instance of the <see cref="T:System.Security.SecurityElement" /> class with the specified tag and text.</summary>
 /// <param name="tag">The tag name of the XML element. </param>
 /// <param name="text">The text content within the element. </param>
 /// <exception cref="T:System.ArgumentNullException">The <paramref name="tag" /> parameter is null. </exception>
 /// <exception cref="T:System.ArgumentException">The <paramref name="tag" /> parameter or <paramref name="text" /> parameter is invalid in XML. </exception>
 public SecurityElement(string tag, string text)
 {
     if (tag == null)
     {
         throw new ArgumentNullException("tag");
     }
     if (!SecurityElement.IsValidTag(tag))
     {
         throw new ArgumentException(Locale.GetText("Invalid XML string") + ": " + tag);
     }
     this.tag  = tag;
     this.Text = text;
 }
Example #2
0
 /// <summary>使用指定的标记初始化 <see cref="T:System.Security.SecurityElement" /> 类的新实例。</summary>
 /// <param name="tag">XML 元素的标记名称。</param>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="tag" /> 参数为 null。</exception>
 /// <exception cref="T:System.ArgumentException">
 /// <paramref name="tag" /> 参数在 XML 中无效。</exception>
 public SecurityElement(string tag)
 {
     if (tag == null)
     {
         throw new ArgumentNullException("tag");
     }
     if (!SecurityElement.IsValidTag(tag))
     {
         throw new ArgumentException(string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_InvalidElementTag"), (object)tag));
     }
     this.m_strTag  = tag;
     this.m_strText = (string)null;
 }
 /// <summary>Initializes a new instance of the <see cref="T:System.Security.SecurityElement" /> class with the specified tag and text.</summary>
 /// <param name="tag">The tag name of the XML element. </param>
 /// <param name="text">The text content within the element. </param>
 /// <exception cref="T:System.ArgumentNullException">The <paramref name="tag" /> parameter is <see langword="null" />. </exception>
 /// <exception cref="T:System.ArgumentException">The <paramref name="tag" /> parameter or <paramref name="text" /> parameter is invalid in XML. </exception>
 // Token: 0x06001BD8 RID: 7128 RVA: 0x0005F8C8 File Offset: 0x0005DAC8
 public SecurityElement(string tag, string text)
 {
     if (tag == null)
     {
         throw new ArgumentNullException("tag");
     }
     if (!SecurityElement.IsValidTag(tag))
     {
         throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_InvalidElementTag"), tag));
     }
     if (text != null && !SecurityElement.IsValidText(text))
     {
         throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_InvalidElementText"), text));
     }
     this.m_strTag  = tag;
     this.m_strText = text;
 }
Example #4
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Security.SecurityElement" /> class with the specified tag and text.</summary>
 /// <param name="tag">The tag name of the XML element. </param>
 /// <param name="text">The text content within the element. </param>
 /// <exception cref="T:System.ArgumentNullException">The <paramref name="tag" /> parameter is null. </exception>
 /// <exception cref="T:System.ArgumentException">The <paramref name="tag" /> parameter or <paramref name="text" /> parameter is invalid in XML. </exception>
 public SecurityElement(string tag, string text)
 {
     if (tag == null)
     {
         throw new ArgumentNullException("tag");
     }
     if (!SecurityElement.IsValidTag(tag))
     {
         throw new ArgumentException(string.Format("Argument_InvalidElementTag", new object[]
         {
             tag
         }));
     }
     if (text != null && !SecurityElement.IsValidText(text))
     {
         throw new ArgumentException(string.Format("Argument_InvalidElementText", new object[]
         {
             text
         }));
     }
     this.m_strTag  = tag;
     this.m_strText = text;
 }
Example #5
0
 /// <summary>Determines whether a string is a valid attribute name.</summary>
 /// <returns>true if the <paramref name="name" /> parameter is a valid XML attribute name; otherwise, false.</returns>
 /// <param name="name">The attribute name to test for validity. </param>
 public static bool IsValidAttributeName(string name)
 {
     return(SecurityElement.IsValidTag(name));
 }