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 SWBaseTag GetTag(string type)
        {
            if (String.IsNullOrWhiteSpace(type))
            {
                return(null);
            }
            type = type.ToLower();

            SWBaseTag tag = null;

            switch (type)
            {
            case SWInputTextTag.Type:
                tag = new SWInputTextTag();
                break;

            case SWDateTag.Type:
                tag = new SWDateTag();
                break;

            case SWVarTag.Type:
                tag = new SWVarTag();
                break;

            case SWQueryTag.Type:
                tag = new SWQueryTag();
                break;

            case SWSelectTag.Type:
                tag = new SWSelectTag();
                break;

            case SWInputDateTag.Type:
                tag = new SWInputDateTag();
                break;

            case SWInputTimeTag.Type:
                tag = new SWInputTimeTag();
                break;
            }
            return(tag);
        }
        private string ProcessTag(SWBaseTag tag, DBContent.TagValueItemTypes htmlType, out string errormessage)
        {
            errormessage = "";
            if (tag == null)
            {
                return "";
            }

            switch (tag.TagType)
            {
                case SWInputTextTag.Type:
                    return this.ProcessInputTextTag(tag as SWInputTextTag, htmlType, out errormessage);
                case SWInputDateTag.Type:
                case SWInputTimeTag.Type:
                    return this.ProcessInputDateTimeTag(tag as SWBaseInputDateTimeTag, htmlType, out errormessage);
                case SWDateTag.Type:
                    return DateTime.Now.ToString();
                case SWVarTag.Type:
                    return this.ProcessVarTag(tag as SWVarTag, htmlType, out errormessage);
                case SWQueryTag.Type:
                    return this.ProcessQueryTag(tag as SWQueryTag, out errormessage);
                case SWSelectTag.Type:
                     return this.ProcessSelectTag(tag as SWSelectTag, htmlType, out errormessage);

             /*   case SWInputDateTag.Type:
                    switch (htmlType)
                    {
                        case DBContent.TagValueItemTypes.Form:
                            return this.ProcessInputDateTag(foundTag as SWInputDateTag, out errormessage);
                        case DBContent.TagValueItemTypes.Template:
                            return foundTag.Value;
                    }
                    break;*/
            }

            return "";
        }