private NewLineToken LoadNewLine(XmlNode newLineNode, int index)
        {
            using (this.StackFrame(newLineNode, index))
            {
                if (!VerifyNodeHasNoChildren(newLineNode))
                {
                    return(null);
                }
                NewLineToken nlt = new NewLineToken();

                return(nlt);
            }
        }
        private List <FormatToken> LoadComplexControlTokenListDefinitions(XmlNode bodyNode)
        {
            using (this.StackFrame(bodyNode))
            {
                List <FormatToken> formatTokenList = new List <FormatToken>();

                int compoundPropertyIndex = 0;
                int newLineIndex          = 0;
                int textIndex             = 0;
                int frameIndex            = 0;

                foreach (XmlNode n in bodyNode.ChildNodes)
                {
                    if (MatchNodeName(n, XmlTags.ExpressionBindingNode))
                    {
                        CompoundPropertyToken cpt = LoadCompoundProperty(n, compoundPropertyIndex++);

                        if (cpt == null)
                        {
                            //Error at XPath {0} in file {1}: {2} failed to load.
                            this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.ExpressionBindingNode));
                            return(null);
                        }

                        formatTokenList.Add(cpt);
                    }
                    else if (MatchNodeName(n, XmlTags.NewLineNode))
                    {
                        NewLineToken nlt = LoadNewLine(n, newLineIndex++);

                        if (nlt == null)
                        {
                            //Error at XPath {0} in file {1}: {2} failed to load.
                            this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.NewLineNode));
                            return(null);
                        }

                        formatTokenList.Add(nlt);
                    }
                    else if (MatchNodeNameWithAttributes(n, XmlTags.TextNode))
                    {
                        TextToken tt = LoadText(n, textIndex++);

                        if (tt == null)
                        {
                            //Error at XPath {0} in file {1}: {2} failed to load.
                            this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.TextNode));
                            return(null);
                        }

                        formatTokenList.Add(tt);
                    }
                    else if (MatchNodeName(n, XmlTags.FrameNode))
                    {
                        FrameToken frame = LoadFrameDefinition(n, frameIndex++);

                        if (frame == null)
                        {
                            //Error at XPath {0} in file {1}: {2} failed to load.
                            this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.FrameNode));
                            return(null);
                        }

                        formatTokenList.Add(frame);
                    }
                    else
                    {
                        this.ProcessUnknownNode(n);
                    }
                }

                if (formatTokenList.Count == 0)
                {
                    //Error at XPath {0} in file {1}: Empty custom control token list.
                    this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.EmptyCustomControlList, ComputeCurrentXPath(), FilePath));
                    return(null);
                }

                return(formatTokenList);
            }
        }