/// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.Remove"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void Remove(XmlAnyElementAttribute attribute)
 {
     List.Remove(attribute);
 }
 /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.Contains"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public bool Contains(XmlAnyElementAttribute attribute)
 {
     return(List.Contains(attribute));
 }
 /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.IndexOf"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public int IndexOf(XmlAnyElementAttribute attribute)
 {
     return(List.IndexOf(attribute));
 }
 /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.Insert"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void Insert(int index, XmlAnyElementAttribute attribute)
 {
     List.Insert(index, attribute);
 }
 /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.Add"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public int Add(XmlAnyElementAttribute attribute)
 {
     return(List.Add(attribute));
 }
示例#6
0
        /// <include file='doc\XmlAttributes.uex' path='docs/doc[@for="XmlAttributes.XmlAttributes1"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public XmlAttributes(IEnumerable <Attribute> attributes)
        {
            // most generic <any/> matches everithig
            XmlAnyElementAttribute wildcard = null;

            foreach (var attrib in attributes)
            {
                if (attrib is XmlIgnoreAttribute || attrib is ObsoleteAttribute || attrib.GetType() == IgnoreAttribute)
                {
                    _xmlIgnore = true;
                    break;
                }
                else if (attrib is XmlElementAttribute)
                {
                    _xmlElements.Add((XmlElementAttribute)attrib);
                }
                else if (attrib is XmlArrayItemAttribute)
                {
                    _xmlArrayItems.Add((XmlArrayItemAttribute)attrib);
                }
                else if (attrib is XmlAnyElementAttribute)
                {
                    XmlAnyElementAttribute any = (XmlAnyElementAttribute)attrib;
                    if ((any.Name == null || any.Name.Length == 0) && any.NamespaceSpecified && any.Namespace == null)
                    {
                        // ignore duplicate wildcards
                        wildcard = any;
                    }
                    else
                    {
                        _xmlAnyElements.Add((XmlAnyElementAttribute)attrib);
                    }
                }
                else if (attrib is DefaultValueAttribute)
                {
                    _xmlDefaultValue = ((DefaultValueAttribute)attrib).Value;
                }
                else if (attrib is XmlAttributeAttribute)
                {
                    _xmlAttribute = (XmlAttributeAttribute)attrib;
                }
                else if (attrib is XmlArrayAttribute)
                {
                    _xmlArray = (XmlArrayAttribute)attrib;
                }
                else if (attrib is XmlTextAttribute)
                {
                    _xmlText = (XmlTextAttribute)attrib;
                }
                else if (attrib is XmlEnumAttribute)
                {
                    _xmlEnum = (XmlEnumAttribute)attrib;
                }
                else if (attrib is XmlRootAttribute)
                {
                    _xmlRoot = (XmlRootAttribute)attrib;
                }
                else if (attrib is XmlTypeAttribute)
                {
                    _xmlType = (XmlTypeAttribute)attrib;
                }
                else if (attrib is XmlAnyAttributeAttribute)
                {
                    _xmlAnyAttribute = (XmlAnyAttributeAttribute)attrib;
                }
                else if (attrib is XmlChoiceIdentifierAttribute)
                {
                    _xmlChoiceIdentifier = (XmlChoiceIdentifierAttribute)attrib;
                }
                else if (attrib is XmlNamespaceDeclarationsAttribute)
                {
                    _xmlns = true;
                }
            }
            if (_xmlIgnore)
            {
                _xmlElements.Clear();
                _xmlArrayItems.Clear();
                _xmlAnyElements.Clear();
                _xmlDefaultValue     = null;
                _xmlAttribute        = null;
                _xmlArray            = null;
                _xmlText             = null;
                _xmlEnum             = null;
                _xmlType             = null;
                _xmlAnyAttribute     = null;
                _xmlChoiceIdentifier = null;
                _xmlns = false;
            }
            else
            {
                if (wildcard != null)
                {
                    _xmlAnyElements.Add(wildcard);
                }
            }
        }