InitializeFromData() public method

Reads the tag from the specified data.
public InitializeFromData ( ParserBase parser, string value, bool hasContents ) : void
parser ParserBase
value string
hasContents bool
return void
Exemplo n.º 1
0
        /// <summary>
        /// Retrurns the tag instance from its type and value.
        /// </summary>
        protected TagBase GetTagFromType(string type, string value, bool hasContents)
        {
            foreach (Type myTagType in Tags)
            {
                string myType = TagBase.GetTagType(myTagType);
                if (string.Compare(myType, type, true) == 0)
                {
                    TagBase myTag = Activator.CreateInstance(myTagType) as TagBase;
                    myTag.InitializeFromData(this, value, hasContents);
                    return(myTag);
                }
            }

            throw new Exception(string.Format("Tag cannot be found: {0}", type));
        }