newtelligence.DasBlog.Web.Core.ValidTag.IsValidAttribute C# (CSharp) Method

IsValidAttribute() public method

Determines whether attribute with the specified attribute name is valid.
public IsValidAttribute ( string attributeName ) : bool
attributeName string Name of the attribute.
return bool
        public bool IsValidAttribute( string attributeName )
        {
            return Array.IndexOf( attributes, attributeName ) >= 0;
        }

Usage Example

Ejemplo n.º 1
0
		/// <summary>
		/// Filters the attributes in the current tag.
		/// </summary>
		/// <param name="validTag">The valid tag, which specifies which attributes are valid.</param>
		public void FilterAttributes(ValidTag validTag){

			// nothing to check against, so no valid attributes
			if( validTag == null ){
				this.attributes = null;
				return;
			}

			CaptureCollection atts = match.Groups["attName"].Captures;
			CaptureCollection vals = match.Groups["attVal"].Captures;
			CaptureCollection attVal = match.Groups["attNameValue"].Captures;

			StringBuilder sb = new StringBuilder();
			
			for( int i = 0, j = 0; i < atts.Count && j < vals.Count; i++){

				string attName = atts[i].Value.Trim();
				string attValue = vals[j].Value.Trim();

				if( validTag.IsValidAttribute( attName ) ){
					// should be a complete att.
					if( attName == attVal[i].Value.Trim() ){
						continue;
					}
					sb.AppendFormat( "{0}=\"{1}\" ", attName, attValue );
				}
				j++;
			}

			attributes = sb.ToString().Trim();
		}
All Usage Examples Of newtelligence.DasBlog.Web.Core.ValidTag::IsValidAttribute