src/Misc/EFTools/XmlCore/Model/Validation/AttributeContentValidator.cs
/// <summary>
///     Returns the XmlSchemaAttribute from the given attribute collection.
/// </summary>
/// <param name="attributes"></param>
/// <param name="qname"></param>
/// <returns></returns>
Returns the XmlSchemaAttribute from the given attribute collection.
Returns the XmlSchemaAttribute from the given attribute collection .
private XmlSchemaAttribute GetXmlSchemaAttributeFromAttributeCollection(
            XmlSchemaObjectCollection attributes, XmlQualifiedName qname)
        {
            if (attributes == null)
            {
                throw new ArgumentNullException("attributes");
            }
            if (qname == null)
            {
                throw new ArgumentNullException("qname");
            }
            XmlSchemaAttribute xmlSchemaAttribute = null;
            foreach (var xo in attributes)
            {
                var xsagr = xo as XmlSchemaAttributeGroupRef;
                var xa = xo as XmlSchemaAttribute;
                if (xsagr != null)
                {
                    var xsag = GetXmlSchemaAttributeGroupFromAttributeGroupRef(xsagr);
                    if (xsag == null)
                    {
                        continue;
                    }
                    xmlSchemaAttribute = GetXmlSchemaAttributeFromAttributeCollection(xsag.Attributes, qname);
                }
                else if (xa != null)
                {
                    if (xa.QualifiedName.Equals(qname))
                    {
                        xmlSchemaAttribute = xa;
                    }
                }
                if (xmlSchemaAttribute != null)
                {
                    break;
                }
            }
            return xmlSchemaAttribute;
        }
private XmlSchemaAttribute GetXmlSchemaAttributeFromAttributeCollection ( XmlSchemaObjectCollection attributes , XmlQualifiedName qname ) { if ( attributes == null ) { throw new ArgumentNullException ( " " ) ; } if ( qname == null ) { throw new ArgumentNullException ( " " ) ; } XmlSchemaAttribute xmlSchemaAttribute = null ; foreach ( var xo in attributes ) { var xsagr = xo as XmlSchemaAttributeGroupRef ; var xa = xo as XmlSchemaAttribute ; if ( xsagr != null ) { var xsag = GetXmlSchemaAttributeGroupFromAttributeGroupRef ( xsagr ) ; if ( xsag == null ) { continue ; } xmlSchemaAttribute = GetXmlSchemaAttributeFromAttributeCollection ( xsag . Attributes , qname ) ; } else if ( xa != null ) { if ( xa . QualifiedName . Equals ( qname ) ) { xmlSchemaAttribute = xa ; } } if ( xmlSchemaAttribute != null ) { break ; } } return xmlSchemaAttribute ; }
Returns the XmlSchemaAttribute from the given attribute collection.
Returns the XmlSchemaAttribute from the given attribute collection .
None
attributes
XmlSchemaObjectCollection
None
qname
XmlQualifiedName
None