/// <summary> /// 读取元素所有的属性值 /// </summary> /// <param name="myReader">HTML文本读取器</param> internal virtual void ReadAttribute(HTMLTextReader myReader) { string strName = null; string strValue = null; while (!myReader.EOF) { myReader.SkipWhiteSpace(); // 若遇到元素结束标记则退出 if (myReader.StartWidth("/>")) { myReader.MoveStep(2); break; } if (myReader.Peek == '>' || myReader.Peek == '<') { myReader.MoveNext(); break; } // 读取属性名 strName = myReader.ReadWord( ); if (strName == null) { break; } strName = strName.ToLower(); // 读取属性值 myReader.SkipWhiteSpace(); if (myReader.EOF || myReader.Peek != '=') { strValue = "1"; } else { myReader.MoveNext(); strValue = myReader.ReadQuotMarkText(); } // 保存属性 if (System.Xml.XmlReader.IsName(strName)) { this.SetAttribute(strName, strValue); } } //while // 设置样式控制表属性 if (HasAttribute(StringConstAttributeName.Style)) { myStyle = new HTMLStyle(); myStyle.CSSString = GetAttribute(StringConstAttributeName.Style); } else { myStyle = null; } }
/// <summary> /// 删除所有的属性 /// </summary> public void ClearAttribute() { myAttributes.Clear(); myStyle = null; }