/*
         * If the control has a Property which matches the name of the
         * attribute, create an AttributeInfo structure for it, that will
         * be used at BuildControl time.
         */
        internal void PreprocessAttribute(string attribname, string attribvalue)
        {
            Match match;

            // Treat a null value as an empty string
            if (attribvalue == null)
            {
                attribvalue = "";
            }

            // Is it a databound attribute?
            if ((match = databindRegex.Match(attribvalue, 0)).Success)
            {
                // If it's a non compiled page, fail if there is code on it
                if (NonCompiledPage)
                {
                    throw new HttpException(
                              HttpRuntime.FormatResourceString(SR.Code_not_supported_on_non_compiled_page));
                }

                // Get the piece of code
                string code = match.Groups["code"].Value;

                if (_boundAttribSetter == null)
                {
                    _boundAttribSetter = new PropertySetter(_ctrlType, InDesigner || NonCompiledPage);
                    _boundAttribSetter.SetDataBound();
                }

                _boundAttribSetter.AddProperty(attribname, code);

                return;
            }

            if (_attribSetter == null)
            {
                _attribSetter = new PropertySetter(_ctrlType, InDesigner || NonCompiledPage);
            }

            _attribSetter.AddProperty(attribname, attribvalue);
        }
        /// <include file='doc\ControlBuilder.uex' path='docs/doc[@for="ControlBuilder.AppendSubBuilder"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public virtual void AppendSubBuilder(ControlBuilder subBuilder)
        {
            // Tell the sub builder that it's about to be appended to its parent
            subBuilder.OnAppendToParentBuilder(this);

            if (FChildrenAsProperties)
            {
                // Don't allow code blocks when properties are expected (ASURT 97838)
                if (subBuilder is CodeBlockBuilder)
                {
                    throw new HttpException(
                              HttpRuntime.FormatResourceString(SR.Code_not_supported_on_not_controls));
                }

                // If there is a default property, delegate to its builder
                if (_defaultPropBuilder != null)
                {
                    _defaultPropBuilder.AppendSubBuilder(subBuilder);
                    return;
                }

                // The tagname is the property name
                string propName = subBuilder.TagName;

                if (subBuilder is TemplateBuilder)     // The subBuilder is for building a template

                {
                    TemplateBuilder tplBuilder = (TemplateBuilder)subBuilder;

                    if (_templateSetter == null)
                    {
                        _templateSetter = new PropertySetter(_ctrlType, InDesigner || NonCompiledPage);
                    }

                    // Add TemplateBuilder to the template setter.
                    _templateSetter.AddTemplateProperty(propName, tplBuilder);
                    return;
                }

                if (subBuilder is CollectionBuilder)     // The subBuilder is for building a collection

                // If there are no items in the collection, we're done
                {
                    if (subBuilder.SubBuilders == null || subBuilder.SubBuilders.Count == 0)
                    {
                        return;
                    }

                    IEnumerator subBuilders = subBuilder.SubBuilders.GetEnumerator();
                    while (subBuilders.MoveNext())
                    {
                        ControlBuilder builder = (ControlBuilder)subBuilders.Current;
                        subBuilder.ComplexAttribSetter.AddCollectionItem(builder);
                    }
                    subBuilder.SubBuilders.Clear();

                    ComplexAttribSetter.AddComplexProperty(propName, subBuilder);
                    return;
                }

                ComplexAttribSetter.AddComplexProperty(propName, subBuilder);
                return;
            }

            CodeBlockBuilder codeBlockBuilder = subBuilder as CodeBlockBuilder;

            if (codeBlockBuilder != null)
            {
                // Don't allow code blocks inside non-control tags (ASURT 76719)
                if (ControlType != null && !typeof(Control).IsAssignableFrom(ControlType))
                {
                    throw new HttpException(
                              HttpRuntime.FormatResourceString(SR.Code_not_supported_on_not_controls));
                }

                // Is it a databinding expression?  <%# ... %>
                if (codeBlockBuilder.BlockType == CodeBlockType.DataBinding)
                {
                    if (InDesigner)
                    {
                        // In the designer, don't use the fancy multipart DataBoundLiteralControl,
                        // which breaks a number of things (ASURT 82925,86738).  Instead, use the
                        // simpler DesignerDataBoundLiteralControl, and do standard databinding
                        // on its Text property.
                        IDictionary attribs = new SortedList();
                        attribs.Add("Text", "<%#" + codeBlockBuilder.Content + "%>");
                        subBuilder = CreateBuilderFromType(
                            Parser, this, typeof(DesignerDataBoundLiteralControl),
                            null, null, attribs, codeBlockBuilder.Line, codeBlockBuilder.SourceFileName);
                    }
                    else
                    {
                        // Get the last builder, and check if it's a DataBoundLiteralControlBuilder
                        object lastBuilder = GetLastBuilder();
                        DataBoundLiteralControlBuilder dataBoundBuilder = lastBuilder as DataBoundLiteralControlBuilder;

                        // If not, then we need to create one.  Otherwise, just append to the
                        // existing one
                        bool fNewDataBoundLiteralControl = false;
                        if (dataBoundBuilder == null)
                        {
                            dataBoundBuilder = new DataBoundLiteralControlBuilder();
                            dataBoundBuilder.Init(_parser, this, typeof(DataBoundLiteralControl),
                                                  null, null, null);

                            fNewDataBoundLiteralControl = true;

                            // If the previous builder was a string, add it as the first
                            // entry in the composite control.
                            string s = lastBuilder as string;
                            if (s != null)
                            {
                                _subBuilders.RemoveAt(_subBuilders.Count - 1);
                                dataBoundBuilder.AddLiteralString(s);
                            }
                        }

                        dataBoundBuilder.AddDataBindingExpression(codeBlockBuilder);

                        if (!fNewDataBoundLiteralControl)
                        {
                            return;
                        }

                        subBuilder = dataBoundBuilder;
                    }
                }
                else
                {
                    // Set a flag if there is at least one block of ASP code
                    _fHasAspCode = true;
                }
            }

            if (FIsNonParserAccessor)
            {
                throw new HttpException(
                          HttpRuntime.FormatResourceString(SR.Children_not_supported_on_not_controls));
            }

            AddSubBuilder(subBuilder);
        }