System.Xml.Schema.XmlSchemaValidator.GetExpectedParticles C# (CSharp) Method

GetExpectedParticles() public method

public GetExpectedParticles ( ) : System.Xml.Schema.XmlSchemaParticle[]
return System.Xml.Schema.XmlSchemaParticle[]
        public XmlSchemaParticle[] GetExpectedParticles()
        {
            if (_currentState == ValidatorState.Start || _currentState == ValidatorState.TopLevelTextOrWS)
            { //Right after initialize
                if (_partialValidationType != null)
                {
                    XmlSchemaElement element = _partialValidationType as XmlSchemaElement;
                    if (element != null)
                    {
                        return new XmlSchemaParticle[1] { element };
                    }
                    return s_emptyParticleArray;
                }
                else
                { //Should return all global elements
                    ICollection elements = _schemaSet.GlobalElements.Values;
                    ArrayList expected = new ArrayList(elements.Count);
                    foreach (XmlSchemaElement element in elements)
                    { //Check for substitutions
                        ContentValidator.AddParticleToExpected(element, _schemaSet, expected, true);
                    }
                    return expected.ToArray(typeof(XmlSchemaParticle)) as XmlSchemaParticle[];
                }
            }
            if (_context.ElementDecl != null)
            {
                ArrayList expected = _context.ElementDecl.ContentValidator.ExpectedParticles(_context, false, _schemaSet);
                if (expected != null)
                {
                    return expected.ToArray(typeof(XmlSchemaParticle)) as XmlSchemaParticle[];
                }
            }
            return s_emptyParticleArray;
        }