/// <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(); }
/// <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(); }