AspNetEdit.Editor.Persistence.ParsingObject.CreateChildParsingObject C# (CSharp) Метод

CreateChildParsingObject() публичный Метод

Creates a ParsingObject as a child of this one, and returns it.
public CreateChildParsingObject ( ILocation location, string tagid, TagAttributes attributes ) : ParsingObject
location ILocation
tagid string
attributes TagAttributes
Результат ParsingObject
        public virtual ParsingObject CreateChildParsingObject(ILocation location, string tagid, TagAttributes attributes)
        {
            string[] str = tagid.Split(':');

            //html tags
            //TODO: check for valid tags?
            if (str.Length == 1)
            {
                if (attributes.IsRunAtServer () && (0 == string.Compare ("form", tagid)))
                    return new ServerFormParsingObject (location.PlainText, tagid, this);
                return new HtmlParsingObject (location.PlainText, tagid, this);
            }

            //fall through to server tags
            if (str.Length != 2)
                throw new ParseException (location, "Server tag name is not of form prefix:name");

            Type tagType = WebFormReferenceManager.GetObjectType(str[0], str[1]);
            if (tagType == null)
                throw new ParseException(location, "The tag " + tagid + "has not been registered");

            return new ServerObjectParsingObject (tagType, attributes.GetDictionary(null), tagid, this);
        }

Usage Example

Пример #1
0
        void TagParsed(ILocation location, TagType tagtype, string tagid, TagAttributes attributes)
        {
            switch (tagtype)
            {
            case TagType.Close:
                if (openObject == null)
                {
                    throw new ParseException(location, "There are more closing tags than opening tags");
                }

                if (0 != string.Compare(openObject.TagID, tagid))
                {
                    throw new ParseException(location, "Closing tag " + tagid + " does not match opening tag " + openObject.TagID);
                }
                openObject = openObject.CloseObject(location.PlainText);
                break;

            case TagType.CodeRender:
                throw new NotImplementedException("Code render expressions have not yet been implemented: " + location.PlainText);

            //break;
            case TagType.CodeRenderExpression:
                throw new NotImplementedException("Code render expressions have not yet been implemented: " + location.PlainText);

            //break;
            case TagType.DataBinding:
                throw new NotImplementedException("Data binding expressions have not yet been implemented: " + location.PlainText);

            //break;
            case TagType.Directive:
                ProcessDirective(tagid, attributes);
                break;

            case TagType.Include:
                throw new NotImplementedException("Server-side includes have not yet been implemented: " + location.PlainText);

            //break;
            case TagType.ServerComment:
                throw new NotImplementedException("Server comments have not yet been implemented: " + location.PlainText);

            //break;
            case TagType.Tag:
                //TODO: don't do this for XHTML
                if ((string.Compare(tagid, "br", true) == 0) ||
                    (string.Compare(tagid, "hr", true) == 0))
                {
                    goto case TagType.SelfClosing;
                }

                openObject = openObject.CreateChildParsingObject(location, tagid, attributes);
                break;

            case TagType.SelfClosing:
                if (openObject == null)
                {
                    throw new Exception("Root tag cannot be self-closing");
                }

                openObject = openObject.CreateChildParsingObject(location, tagid, attributes);
                openObject = openObject.CloseObject(string.Empty);
                break;

            case TagType.Text:
                throw new NotImplementedException("Text tagtypes have not yet been implemented: " + location.PlainText);
                //break;
            }
        }
All Usage Examples Of AspNetEdit.Editor.Persistence.ParsingObject::CreateChildParsingObject