コード例 #1
0
		public void NameDefault ()
		{
			XmlAnyElementAttribute attr = new XmlAnyElementAttribute ();
			Assert.AreEqual (string.Empty, attr.Name, "#1");

			attr.Name = null;
			Assert.AreEqual (string.Empty, attr.Name, "#2");
		}
コード例 #2
0
        /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.Insert"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public void Insert(int index, XmlAnyElementAttribute value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            _list.Insert(index, value);
        }
コード例 #3
0
        /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.Insert"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public void Insert(int index, XmlAnyElementAttribute value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            _list.Insert(index, value);
        }
コード例 #4
0
        /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.Add"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public int Add(XmlAnyElementAttribute value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            int index = _list.Count;
            _list.Add(value);
            return index;
        }
コード例 #5
0
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public void Remove(XmlAnyElementAttribute value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (!_list.Remove(value))
            {
                throw new ArgumentException(SR.Arg_RemoveArgNotFound);
            }
        }
コード例 #6
0
        /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.Add"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public int Add(XmlAnyElementAttribute value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            int index = _list.Count;

            _list.Add(value);
            return(index);
        }
コード例 #7
0
        /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.Remove"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public void Remove(XmlAnyElementAttribute value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (!_list.Remove(value))
            {
                throw new ArgumentException(SR.Arg_RemoveArgNotFound);
            }
        }
コード例 #8
0
		public void DifferentNamespacesAnyElementAttributes()
		{
			XmlAnyElementAttribute any1 = new XmlAnyElementAttribute("myname", "myns");
			XmlAnyElementAttribute any2 = new XmlAnyElementAttribute("myname", "myotherns");

			atts1.XmlAnyElements.Add(any1);
			atts2.XmlAnyElements.Add(any2);

			ov1.Add(typeof(SerializeMe), "TheMember", atts1);
			ov2.Add(typeof(SerializeMe), "TheMember", atts2);

			ThumbprintHelpers.DifferentThumbprint(ov1, ov2);
		}
コード例 #9
0
		public void AnyElementAttributesSameMember()
		{
			XmlAnyElementAttribute any1 = new XmlAnyElementAttribute();
			XmlAnyElementAttribute any2 = new XmlAnyElementAttribute();

			atts1.XmlAnyElements.Add(any1);
			atts2.XmlAnyElements.Add(any2);

			ov1.Add(typeof(SerializeMe), "TheMember", atts1);
			ov2.Add(typeof(SerializeMe), "TheMember", atts2);

			ThumbprintHelpers.SameThumbprint(ov1, ov2);
		}
コード例 #10
0
		public void TwoDifferentAnyElement()
		{
			XmlAnyElementAttribute any1 = new XmlAnyElementAttribute("myname", "myns");
			XmlAnyElementAttribute any2 = new XmlAnyElementAttribute("myothername", "myns");
			XmlAnyElementAttribute any3 = new XmlAnyElementAttribute("mythirdname", "my3ns");

			atts1.XmlAnyElements.Add(any1);
			atts1.XmlAnyElements.Add(any2);

			atts2.XmlAnyElements.Add(any3);
			atts2.XmlAnyElements.Add(any2);

			ov1.Add(typeof(SerializeMe), atts1);
			ov2.Add(typeof(SerializeMe), atts2);

			ThumbprintHelpers.DifferentThumbprint(ov1, ov2);
		}
コード例 #11
0
 /// <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);
 }
コード例 #12
0
 /// <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);
 }
コード例 #13
0
 /// <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);
 }
コード例 #14
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void Remove(XmlAnyElementAttribute attribute)
 {
     List.Remove(attribute);
 }
コード例 #15
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public int IndexOf(XmlAnyElementAttribute attribute)
 {
     return(List.IndexOf(attribute));
 }
コード例 #16
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public int Add(XmlAnyElementAttribute attribute)
 {
     return(List.Add(attribute));
 }
コード例 #17
0
 /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.Contains"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public bool Contains(XmlAnyElementAttribute value)
 {
     return _list.Contains(value);
 }
コード例 #18
0
ファイル: NodeInfo.cs プロジェクト: zanyants/mvp.xml
		/// <summary>
		/// Adds new attribute to the node decorations.
		/// </summary>
		/// <param name="attr">An attriubute.</param>
		protected void Add( object attr )
		{
			if( attr is NodePolicyAttribute )
			{
				if( _nodePolicy == null )
					_nodePolicy = (NodePolicyAttribute)attr;
			}
			else if( attr is ConverterAttribute )
			{
				if( _converter == null )
					_converter = (ConverterAttribute)attr;
			}
			else if( attr is TransparentAttribute ) 
			{
				_transparent = (TransparentAttribute)attr;
			}
			else if( attr is SkipNavigableRootAttribute ) 
			{
				_skipNavigableRoot = (SkipNavigableRootAttribute)attr;
			}
			else if( attr is ChildXmlElementAttribute ) 
			{
				_childXmlElementName = (ChildXmlElementAttribute)attr;
			}
			else if( attr is XmlRootAttribute ) 
			{
				if( _xmlRoot == null ) 
					_xmlRoot = (XmlRootAttribute)attr;
			}
			else if( attr is XmlAttributeAttribute ) 
			{
				if( NodeTypeUndefined() )
					_xmlAttribute = (XmlAttributeAttribute)attr;
			}
			else if( attr is XmlElementAttribute ) 
			{
				if( NodeTypeUndefined() ) 
				{
					_xmlElement = (XmlElementAttribute)attr;
					_isNullable = _xmlElement.IsNullable;
				}
			}
			else if( attr is XmlAnyElementAttribute ) 
			{
				if( NodeTypeUndefined() )
					_xmlAnyElement = (XmlAnyElementAttribute)attr;
			}
			else if( attr is XmlTextAttribute ) 
			{
				if( NodeTypeUndefined() )
					_xmlText = (XmlTextAttribute)attr;
			}
			else if( attr is XmlIgnoreAttribute ) 
			{
				_xmlIgnore = (XmlIgnoreAttribute)attr;
			}
			else if( attr is XmlTypeAttribute ) 
			{
				_xmlType = (XmlTypeAttribute)attr;
			}
		}
コード例 #19
0
		public int Add(XmlAnyElementAttribute attribute)
		{
			return (List as IList).Add (attribute);
		}
コード例 #20
0
        public XmlAttributes(ICustomAttributeProvider provider)
        {
            this.xmlElements    = new XmlElementAttributes();
            this.xmlArrayItems  = new XmlArrayItemAttributes();
            this.xmlAnyElements = new XmlAnyElementAttributes();
            object[] customAttributes        = provider.GetCustomAttributes(false);
            XmlAnyElementAttribute attribute = null;

            for (int i = 0; i < customAttributes.Length; i++)
            {
                if (((customAttributes[i] is XmlIgnoreAttribute) || (customAttributes[i] is ObsoleteAttribute)) || (customAttributes[i].GetType() == IgnoreAttribute))
                {
                    this.xmlIgnore = true;
                    break;
                }
                if (customAttributes[i] is XmlElementAttribute)
                {
                    this.xmlElements.Add((XmlElementAttribute)customAttributes[i]);
                }
                else if (customAttributes[i] is XmlArrayItemAttribute)
                {
                    this.xmlArrayItems.Add((XmlArrayItemAttribute)customAttributes[i]);
                }
                else if (customAttributes[i] is XmlAnyElementAttribute)
                {
                    XmlAnyElementAttribute attribute2 = (XmlAnyElementAttribute)customAttributes[i];
                    if (((attribute2.Name == null) || (attribute2.Name.Length == 0)) && (attribute2.NamespaceSpecified && (attribute2.Namespace == null)))
                    {
                        attribute = attribute2;
                    }
                    else
                    {
                        this.xmlAnyElements.Add((XmlAnyElementAttribute)customAttributes[i]);
                    }
                }
                else if (customAttributes[i] is DefaultValueAttribute)
                {
                    this.xmlDefaultValue = ((DefaultValueAttribute)customAttributes[i]).Value;
                }
                else if (customAttributes[i] is XmlAttributeAttribute)
                {
                    this.xmlAttribute = (XmlAttributeAttribute)customAttributes[i];
                }
                else if (customAttributes[i] is XmlArrayAttribute)
                {
                    this.xmlArray = (XmlArrayAttribute)customAttributes[i];
                }
                else if (customAttributes[i] is XmlTextAttribute)
                {
                    this.xmlText = (XmlTextAttribute)customAttributes[i];
                }
                else if (customAttributes[i] is XmlEnumAttribute)
                {
                    this.xmlEnum = (XmlEnumAttribute)customAttributes[i];
                }
                else if (customAttributes[i] is XmlRootAttribute)
                {
                    this.xmlRoot = (XmlRootAttribute)customAttributes[i];
                }
                else if (customAttributes[i] is XmlTypeAttribute)
                {
                    this.xmlType = (XmlTypeAttribute)customAttributes[i];
                }
                else if (customAttributes[i] is XmlAnyAttributeAttribute)
                {
                    this.xmlAnyAttribute = (XmlAnyAttributeAttribute)customAttributes[i];
                }
                else if (customAttributes[i] is XmlChoiceIdentifierAttribute)
                {
                    this.xmlChoiceIdentifier = (XmlChoiceIdentifierAttribute)customAttributes[i];
                }
                else if (customAttributes[i] is XmlNamespaceDeclarationsAttribute)
                {
                    this.xmlns = true;
                }
            }
            if (this.xmlIgnore)
            {
                this.xmlElements.Clear();
                this.xmlArrayItems.Clear();
                this.xmlAnyElements.Clear();
                this.xmlDefaultValue     = null;
                this.xmlAttribute        = null;
                this.xmlArray            = null;
                this.xmlText             = null;
                this.xmlEnum             = null;
                this.xmlType             = null;
                this.xmlAnyAttribute     = null;
                this.xmlChoiceIdentifier = null;
                this.xmlns = false;
            }
            else if (attribute != null)
            {
                this.xmlAnyElements.Add(attribute);
            }
        }
 public void Remove(System.Xml.Serialization.XmlAnyElementAttribute attribute)
 {
 }
 public int Add(System.Xml.Serialization.XmlAnyElementAttribute attribute)
 {
     throw null;
 }
コード例 #23
0
 /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.IndexOf"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public int IndexOf(XmlAnyElementAttribute value)
 {
     return(_list.IndexOf(value));
 }
コード例 #24
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void Insert(int index, XmlAnyElementAttribute attribute)
 {
     List.Insert(index, attribute);
 }
コード例 #25
0
 /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.Contains"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public bool Contains(XmlAnyElementAttribute value)
 {
     return(_list.Contains(value));
 }
コード例 #26
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public bool Contains(XmlAnyElementAttribute attribute)
 {
     return(List.Contains(attribute));
 }
コード例 #27
0
 /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.IndexOf"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public int IndexOf(XmlAnyElementAttribute value)
 {
     return _list.IndexOf(value);
 }
コード例 #28
0
ファイル: XmlAttributes.cs プロジェクト: karthikrajkumar/demo
        /// <include file='doc\XmlAttributes.uex' path='docs/doc[@for="XmlAttributes.XmlAttributes1"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public XmlAttributes(MemberInfo memberInfo)
        {
            object[] attrs = memberInfo.GetCustomAttributes(false).ToArray();

            // most generic <any/> matches everithig
            XmlAnyElementAttribute wildcard = null;

            for (int i = 0; i < attrs.Length; i++)
            {
                if (attrs[i] is XmlIgnoreAttribute || attrs[i] is ObsoleteAttribute || attrs[i].GetType() == IgnoreAttribute)
                {
                    _xmlIgnore = true;
                    break;
                }
                else if (attrs[i] is XmlElementAttribute)
                {
                    _xmlElements.Add((XmlElementAttribute)attrs[i]);
                }
                else if (attrs[i] is XmlArrayItemAttribute)
                {
                    _xmlArrayItems.Add((XmlArrayItemAttribute)attrs[i]);
                }
                else if (attrs[i] is XmlAnyElementAttribute)
                {
                    XmlAnyElementAttribute any = (XmlAnyElementAttribute)attrs[i];
                    if ((any.Name == null || any.Name.Length == 0) && any.NamespaceSpecified && any.Namespace == null)
                    {
                        // ignore duplicate wildcards
                        wildcard = any;
                    }
                    else
                    {
                        _xmlAnyElements.Add((XmlAnyElementAttribute)attrs[i]);
                    }
                }
                else if (attrs[i] is DefaultValueAttribute)
                {
                    _xmlDefaultValue = ((DefaultValueAttribute)attrs[i]).Value;
                }
                else if (attrs[i] is XmlAttributeAttribute)
                {
                    _xmlAttribute = (XmlAttributeAttribute)attrs[i];
                }
                else if (attrs[i] is XmlArrayAttribute)
                {
                    _xmlArray = (XmlArrayAttribute)attrs[i];
                }
                else if (attrs[i] is XmlTextAttribute)
                {
                    _xmlText = (XmlTextAttribute)attrs[i];
                }
                else if (attrs[i] is XmlEnumAttribute)
                {
                    _xmlEnum = (XmlEnumAttribute)attrs[i];
                }
                else if (attrs[i] is XmlRootAttribute)
                {
                    _xmlRoot = (XmlRootAttribute)attrs[i];
                }
                else if (attrs[i] is XmlTypeAttribute)
                {
                    _xmlType = (XmlTypeAttribute)attrs[i];
                }
                else if (attrs[i] is XmlAnyAttributeAttribute)
                {
                    _xmlAnyAttribute = (XmlAnyAttributeAttribute)attrs[i];
                }
                else if (attrs[i] is XmlChoiceIdentifierAttribute)
                {
                    _xmlChoiceIdentifier = (XmlChoiceIdentifierAttribute)attrs[i];
                }
                else if (attrs[i] 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);
                }
            }
        }
コード例 #29
0
		public void NamespaceDefault ()
		{
			XmlAnyElementAttribute attr = new XmlAnyElementAttribute ();
			Assert.IsNull (attr.Namespace);
		}
コード例 #30
0
 /// <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);
 }
 public bool Contains(System.Xml.Serialization.XmlAnyElementAttribute attribute)
 {
     throw null;
 }
コード例 #32
0
 /// <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);
 }
 public void Insert(int index, System.Xml.Serialization.XmlAnyElementAttribute attribute)
 {
 }
コード例 #34
0
 /// <include file='doc\XmlAnyElementAttributes.uex' path='docs/doc[@for="XmlAnyElementAttributes.CopyTo"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void CopyTo(XmlAnyElementAttribute[] array, int index) {
     List.CopyTo(array, index);
 }
コード例 #35
0
		public void TwoSameAnyElement()
		{
			XmlAnyElementAttribute any1 = new XmlAnyElementAttribute("myname", "myns");
			XmlAnyElementAttribute any2 = new XmlAnyElementAttribute("myothername", "myns");

			atts1.XmlAnyElements.Add(any1);
			atts1.XmlAnyElements.Add(any2);

			atts2.XmlAnyElements.Add(any1);
			atts2.XmlAnyElements.Add(any2);

			ThumbprintHelpers.SameThumbprint(ov1, ov2);
		}