Ejemplo n.º 1
0
 protected SWBaseTag(BaseTagTypes baseTagType, string tagType)
 {
     this._value      = "";
     this._name       = "";
     this.BaseTagType = baseTagType;
     this.TagType     = tagType.ToLower();
 }
Ejemplo n.º 2
0
 protected SWBaseTag(BaseTagTypes baseTagType, string tagType)
 {
     this._value = "";
     this._name = "";
     this.BaseTagType = baseTagType;
     this.TagType = tagType.ToLower();
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
 protected SWBaseSQLTag(BaseTagTypes baseTagType, string tagType)
     : base(baseTagType, tagType)
 {
 }
Ejemplo n.º 6
0
 protected SWBaseSQLTag(BaseTagTypes baseTagType, string tagType)
     : base(baseTagType, tagType)
 {
 }