示例#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
        internal static bool GetNamespaceSpecified(this XmlAnyElementAttribute xmlAnyElementAtt)
        {
            if (s_NamespaceSpecifiedPropertyInfo == null)
            {
                s_NamespaceSpecifiedPropertyInfo = typeof(XmlAnyElementAttribute).GetProperty("NamespaceSpecified", BindingFlags.NonPublic | BindingFlags.Instance);
            }

            return((bool)s_NamespaceSpecifiedPropertyInfo.GetValue(xmlAnyElementAtt));
        }
示例#3
0
 private XmlSerializer CreateOverrideSerializer(){
    XmlAnyElementAttribute myAnyElement = 
    new XmlAnyElementAttribute();
    XmlAttributeOverrides xOverride = 
    new XmlAttributeOverrides();
    XmlAttributes xAtts = new XmlAttributes();
    xAtts.XmlAnyElements.Add(myAnyElement);
    xOverride.Add(typeof(Group), "Things", xAtts);
    return new XmlSerializer(typeof(Group) , xOverride);
 }
        public void AnyElementAttributeDifferentMember()
        {
            XmlAnyElementAttribute any1 = new XmlAnyElementAttribute("myname", "myns");

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

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

            ThumbprintHelpers.DifferentThumbprint(ov1, ov2);
        }
        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);
        }
        public void AnyElementAttributesSameNamespace()
        {
            XmlAnyElementAttribute any1 = new XmlAnyElementAttribute("myname", "myns");
            XmlAnyElementAttribute any2 = new XmlAnyElementAttribute("myname", "myns");

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

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

            ThumbprintHelpers.SameThumbprint(ov1, ov2);
        }
        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);
        }
示例#8
0
 public void Remove(XmlAnyElementAttribute attribute);
示例#9
0
 public void Insert(int index, XmlAnyElementAttribute attribute);
示例#10
0
 public int IndexOf(XmlAnyElementAttribute attribute);
示例#11
0
 public bool Contains(XmlAnyElementAttribute attribute);
示例#12
0
 public int Add(XmlAnyElementAttribute attribute);
示例#13
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void Remove(XmlAnyElementAttribute attribute)
 {
     List.Remove(attribute);
 }
示例#14
0
 /// <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;
     }
 }
示例#15
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public int IndexOf(XmlAnyElementAttribute attribute)
 {
     return(List.IndexOf(attribute));
 }
示例#16
0
        public void NamespaceDefault()
        {
            XmlAnyElementAttribute attr = new XmlAnyElementAttribute();

            Assert.IsNull(attr.Namespace);
        }
 public void CopyTo(XmlAnyElementAttribute[] array, int index);
 public bool Contains(XmlAnyElementAttribute attribute);
 public int Add(XmlAnyElementAttribute attribute);
 /// <summary>
 /// Sets the <see cref="XmlAnyElementAttribute"/> for the property.
 /// </summary>
 public OverrideMemberXml <T> Attr(XmlAnyElementAttribute attribute)
 {
     Attributes.XmlAnyElements.Add(attribute);
     return(this);
 }
示例#21
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public bool Contains(XmlAnyElementAttribute attribute)
 {
     return(List.Contains(attribute));
 }
示例#22
0
 /// <summary>
 /// Adds specified instance of XmlAnyElementAttribute to current type or member
 /// </summary>
 public OverrideXml Attr(XmlAnyElementAttribute attribute)
 {
     Open();
     _attributes.XmlAnyElements.Add(attribute);
     return(this);
 }
 public int IndexOf(XmlAnyElementAttribute attribute);
示例#24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XmlQualifiedEntity"/> class.
 /// </summary>
 /// <param name="attribute">The XML related attribute to extract qualified name information about.</param>
 public XmlQualifiedEntity(XmlAnyElementAttribute attribute) : this(ValidateArguments(attribute).Name, ValidateArguments(attribute).Namespace)
 {
 }
 public void Insert(int index, XmlAnyElementAttribute attribute);
 public void Remove(XmlAnyElementAttribute attribute);
示例#27
0
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public XmlAttributes(ICustomAttributeProvider provider)
        {
            object[] attrs = provider.GetCustomAttributes(false);

            // most generic <any/> matches everything
            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);
                }
            }
        }
示例#28
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public int Add(XmlAnyElementAttribute attribute)
 {
     return(List.Add(attribute));
 }