protected SWBaseTag(BaseTagTypes baseTagType, string tagType) { this._value = ""; this._name = ""; this.BaseTagType = baseTagType; this.TagType = tagType.ToLower(); }
public static List <SWBaseTag> GetTags(string html, BaseTagTypes baseTagType) { if (String.IsNullOrWhiteSpace(html)) { return(new List <SWBaseTag>()); } List <SWBaseTag> result = new List <SWBaseTag>(); int startIndex = -1; int endIndex = -1; html = html.ToLower(); while ((startIndex = html.IndexOf(SWBaseTag.TagStart.ToLower(), endIndex + 1)) >= 0) { endIndex = html.IndexOf(SWBaseTag.TagEnd.ToLower(), startIndex); int tempStart = html.IndexOf(SWBaseTag.TagStart.ToLower()); if (tempStart > endIndex) { continue; } string xmlTag = html.Substring(startIndex, endIndex - startIndex + 1); XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlTag.ToLower()); XmlNode newNode = doc.DocumentElement; SWBaseTag tag = null; XmlAttribute typeAttr = newNode.Attributes[SWBaseTag.TypeAttribute]; if (typeAttr != null) { tag = GetTag(typeAttr.Value); } if (tag == null) { continue; } XmlAttribute nameAttr = newNode.Attributes[SWBaseTag.NameAttribute]; if (nameAttr != null) { tag.Name = nameAttr.Value; } tag.Attributes = newNode.Attributes; if (tag != null && tag.BaseTagType == baseTagType || tag.BaseTagType == BaseTagTypes.Both) { result.Add(tag); } } return(result); }
public static List<SWBaseTag> GetTags(string html, BaseTagTypes baseTagType) { if (String.IsNullOrWhiteSpace(html)) return new List<SWBaseTag>(); List<SWBaseTag> result = new List<SWBaseTag>(); int startIndex = -1; int endIndex = -1; html = html.ToLower(); while ((startIndex = html.IndexOf(SWBaseTag.TagStart.ToLower(), endIndex + 1)) >= 0) { endIndex = html.IndexOf(SWBaseTag.TagEnd.ToLower(), startIndex); int tempStart = html.IndexOf(SWBaseTag.TagStart.ToLower()); if (tempStart > endIndex) continue; string xmlTag = html.Substring(startIndex, endIndex - startIndex + 1); XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlTag.ToLower()); XmlNode newNode = doc.DocumentElement; SWBaseTag tag = null; XmlAttribute typeAttr = newNode.Attributes[SWBaseTag.TypeAttribute]; if (typeAttr != null) { tag = GetTag(typeAttr.Value); } if (tag == null) continue; XmlAttribute nameAttr = newNode.Attributes[SWBaseTag.NameAttribute]; if (nameAttr != null) { tag.Name = nameAttr.Value; } tag.Attributes = newNode.Attributes; if (tag != null && tag.BaseTagType == baseTagType || tag.BaseTagType == BaseTagTypes.Both) { result.Add(tag); } } return result; }
protected SWBaseSQLTag(BaseTagTypes baseTagType, string tagType) : base(baseTagType, tagType) { }