src/Misc/EFTools/XmlCore/Model/Validation/AttributeContentValidator.cs
/// <summary>
///     Returns the XmlSchemaElement named by the given qname from the specified XmlSchemaGroupBase
/// </summary>
Returns the XmlSchemaElement named by the given qname from the specified XmlSchemaGroupBase
Returns the XmlSchemaElement named by the given qname from the specified XmlSchemaGroupBase
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
        private XmlSchemaElement GetXmlElementFromXmlSchemaGroupBase(XmlSchemaGroupBase xsgb, XmlQualifiedName curr)
        {
            XmlSchemaElement schemaElement = null;
            foreach (var xso in xsgb.Items)
            {
                var xsgr = xso as XmlSchemaGroupRef;
                if (xsgr != null)
                {
                    schemaElement = GetXmlElementFromXmlSchemaGroupBase(xsgr.Particle, curr);
                }
                else if (xso is XmlSchemaElement)
                {
                    var xse = xso as XmlSchemaElement;
                    if (xse.QualifiedName.Equals(curr))
                    {
                        schemaElement = xse;
                    }
                }
                else if (xso is XmlSchemaChoice)
                {
                    var xsc = xso as XmlSchemaChoice;
                    schemaElement = GetXmlSchemaElement(xsc.Items, curr);
                }
                else if (xso is XmlSchemaAny)
                {
                    continue;
                }
                else if (xso is XmlSchemaSequence)
                {
                    var xss = xso as XmlSchemaSequence;
                    schemaElement = GetXmlSchemaElement(xss.Items, curr);
                }
                else
                {
                    Debug.Fail("unexpected type of XmlSchemaGroupBase!");
                }
                if (schemaElement != null)
                {
                    break;
                }
            }
            return schemaElement;
        }
[ SuppressMessage ( " " , " " ) ] private XmlSchemaElement GetXmlElementFromXmlSchemaGroupBase ( XmlSchemaGroupBase xsgb , XmlQualifiedName curr ) { XmlSchemaElement schemaElement = null ; foreach ( var xso in xsgb . Items ) { var xsgr = xso as XmlSchemaGroupRef ; if ( xsgr != null ) { schemaElement = GetXmlElementFromXmlSchemaGroupBase ( xsgr . Particle , curr ) ; } else if ( xso is XmlSchemaElement ) { var xse = xso as XmlSchemaElement ; if ( xse . QualifiedName . Equals ( curr ) ) { schemaElement = xse ; } } else if ( xso is XmlSchemaChoice ) { var xsc = xso as XmlSchemaChoice ; schemaElement = GetXmlSchemaElement ( xsc . Items , curr ) ; } else if ( xso is XmlSchemaAny ) { continue ; } else if ( xso is XmlSchemaSequence ) { var xss = xso as XmlSchemaSequence ; schemaElement = GetXmlSchemaElement ( xss . Items , curr ) ; } else { Debug . Fail ( " " ) ; } if ( schemaElement != null ) { break ; } } return schemaElement ; }
Returns the XmlSchemaElement named by the given qname from the specified XmlSchemaGroupBase
Returns the XmlSchemaElement named by the given qname from the specified XmlSchemaGroupBase
xsgb
XmlSchemaGroupBase
curr
XmlQualifiedName