private void OnAttributeFilterItem(string keyword, XPathNavigator navigator)
        {
            ReferenceRootFilter attributeFilters = _group.Content.AttributeFilters;

            // If there is customization of the attribute filters, we use it...
            if (attributeFilters != null && attributeFilters.Count != 0)
            {
                XmlWriter writer = navigator.InsertAfter();

                //<attributeFilter expose="true">
                //  <namespace name="System.Diagnostics" expose="false">
                //    <type name="ConditionalAttribute" expose="true" />
                //  </namespace>
                //  <namespace name="System.Xml.Serialization" expose="false" />
                //</attributeFilter>
                writer.WriteStartElement("attributeFilter");
                writer.WriteAttributeString("expose", "true");

                int itemNamespaces = attributeFilters.Count;
                for (int i = 0; i < itemNamespaces; i++)
                {
                    ReferenceNamespaceFilter namespaceFilter = attributeFilters[i];
                    if (namespaceFilter == null)
                    {
                        continue;
                    }
                    namespaceFilter.WriteXml(writer);
                }

                writer.WriteEndElement();

                writer.Close();
            }
            else  //...otherwise, we put in the default atttribute filters...
            {
                // Write the defaults...
                if (String.IsNullOrEmpty(_defaultAttrFile) == false &&
                    File.Exists(_defaultAttrFile))
                {
                    XmlReaderSettings settings = new XmlReaderSettings();
                    settings.IgnoreWhitespace = true;
                    settings.IgnoreComments   = false;
                    settings.CloseInput       = true;

                    using (XmlReader xmlReader = XmlReader.Create(
                               _defaultAttrFile, settings))
                    {
                        if (xmlReader.IsStartElement("attributeFilter"))
                        {
                            navigator.InsertAfter(xmlReader);
                        }
                    }
                }
            }

            navigator.DeleteSelf();
        }
        private void OnApiFilterItem(string keyword, XPathNavigator navigator)
        {
            XmlWriter writer = navigator.InsertAfter();

            // <apiFilter expose="true">
            //   <namespace name="System" expose="true">
            //     <type name="Object" expose="false">
            //       <member name="ToString" expose="true" />
            //     </type>
            //   </namespace>
            // </apiFilter>
            writer.WriteStartElement("apiFilter");
            writer.WriteAttributeString("expose", "true");

            // Handle compiler and Generator outputs
            if (_compilerRootFilter != null && _compilerRootFilter.Count != 0)
            {
                int itemNamespaces = _compilerRootFilter.Count;
                for (int i = 0; i < itemNamespaces; i++)
                {
                    ReferenceNamespaceFilter namespaceFilter = _compilerRootFilter[i];
                    namespaceFilter.WriteXml(writer);
                }
            }

            ReferenceRootFilter typeFilters = _group.Content.TypeFilters;

            if (typeFilters != null && typeFilters.Count != 0)
            {
                int itemNamespaces = typeFilters.Count;
                for (int i = 0; i < itemNamespaces; i++)
                {
                    ReferenceNamespaceFilter namespaceFilter = typeFilters[i];
                    namespaceFilter.WriteXml(writer);
                }
            }

            writer.WriteEndElement();

            writer.Close();
            navigator.DeleteSelf();
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteXml(XmlWriter writer)
        {
            BuildExceptions.NotNull(writer, "writer");

            //<apiFilter expose="true">
            //    <namespace name="XamlGeneratedNamespace" expose="false" />
            //</apiFilter>
            bool isExposed = this.Expose;

            writer.WriteStartElement(TagName);
            writer.WriteAttributeString("name", this.Name);
            writer.WriteAttributeString("expose", isExposed.ToString());
            writer.WriteAttributeString("type", _isAttributes ?
                                        "AttributeFilter" : "ApiFilter");

            int itemCount = _listNamespaces == null ? 0 : _listNamespaces.Count;

            if (isExposed)
            {
                for (int i = 0; i < itemCount; i++)
                {
                    ReferenceNamespaceFilter namespaceFilter = _listNamespaces[i];
                    //if (!namespaceFilter.Expose)
                    {
                        namespaceFilter.WriteXml(writer);
                    }
                }
            }
            else
            {
                for (int i = 0; i < itemCount; i++)
                {
                    ReferenceNamespaceFilter namespaceFilter = _listNamespaces[i];
                    //if (namespaceFilter.Expose)
                    {
                        namespaceFilter.WriteXml(writer);
                    }
                }
            }

            writer.WriteEndElement();
        }