System.Xml.Serialization.XmlReflectionImporter.CheckTopLevelAttributes C# (CSharp) Method

CheckTopLevelAttributes() private method

private CheckTopLevelAttributes ( XmlAttributes a, string accessorName ) : void
a XmlAttributes
accessorName string
return void
        private void CheckTopLevelAttributes(XmlAttributes a, string accessorName)
        {
            XmlAttributeFlags flags = a.XmlFlags;

            if ((flags & (XmlAttributeFlags.Attribute | XmlAttributeFlags.AnyAttribute)) != 0)
                throw new InvalidOperationException(SR.XmlRpcLitAttributeAttributes);

            if ((flags & (XmlAttributeFlags.Text | XmlAttributeFlags.AnyElements | XmlAttributeFlags.ChoiceIdentifier)) != 0)
                throw new InvalidOperationException(SR.XmlRpcLitAttributes);

            if (a.XmlElements != null && a.XmlElements.Count > 0)
            {
                if (a.XmlElements.Count > 1)
                {
                    throw new InvalidOperationException(SR.XmlRpcLitElements);
                }
                XmlElementAttribute xmlElement = a.XmlElements[0];
                if (xmlElement.Namespace != null)
                {
                    throw new InvalidOperationException(SR.Format(SR.XmlRpcLitElementNamespace, "Namespace", xmlElement.Namespace));
                }
                if (xmlElement.IsNullable)
                {
                    throw new InvalidOperationException(SR.Format(SR.XmlRpcLitElementNullable, "IsNullable", "true"));
                }
            }
            if (a.XmlArray != null && a.XmlArray.Namespace != null)
            {
                throw new InvalidOperationException(SR.Format(SR.XmlRpcLitElementNamespace, "Namespace", a.XmlArray.Namespace));
            }
        }