Ejemplo n.º 1
0
        void getGroup(Group group, ElementType parent)
        {
            // This gets a choice or sequence.

            bool moreCPs = true;

            while (moreCPs)
            {
                discardWhitespace();
                getContentParticle(group, parent);
                discardWhitespace();
                if (isChar('|'))
                {
                    if (group.Type == ParticleType.Unknown)
                    {
                        group.Type = ParticleType.Choice;
                    }
                    else if (group.Type == ParticleType.Sequence)
                    {
                        throwXMLMiddlewareException("Invalid mixture of ',' and '|' in content model.");
                    }
                }
                else if (isChar(','))
                {
                    if (group.Type == ParticleType.Unknown)
                    {
                        group.Type = ParticleType.Sequence;
                    }
                    else if (group.Type == ParticleType.Choice)
                    {
                        throwXMLMiddlewareException("Invalid mixture of ',' and '|' in content model.");
                    }
                }
                else if (isChar(')'))
                {
                    moreCPs = false;
                    getFrequency(group);

                    // If there is a single content particle in the group,
                    // we simply call it a sequence.

                    if (group.Type == ParticleType.Unknown)
                    {
                        group.Type = ParticleType.Sequence;
                    }
                }
            }
            group.FinaliseGroup();
        }