protected override SchemaRow ReadRow(ExcelWorksheet schemaWorksheet, int row)
        {
            if (row > schemaWorksheet.Dimension.End.Row)
            {
                return(null);
            }

            XmlFileSchemaRow schemaRow = new XmlFileSchemaRow();

            // Read all first 5 cell value
            for (int i = 0; i < 5; i++)
            {
                schemaRow.ElementName = GCExcelReaderHelper.ReadCell(schemaWorksheet, row, i + 1);
                if (string.IsNullOrWhiteSpace(schemaRow.ElementName) == false)
                {
                    schemaRow.Level = i + 1;
                    break;
                }
            }

            base.ReadBasicRowData(schemaWorksheet, schemaRow, row);

            // If data type is not-null then set IsLeafNode flag true
            schemaRow.IsLeafNode = !string.IsNullOrWhiteSpace(schemaRow.DataType);

            return(schemaRow);
        }
        private IPluglet GetNextNode(ExcelWorksheet schemaWorksheet, int currentLevel, ref int row)
        {
            // TODO: Handle this in better way
            if (row > schemaWorksheet.Dimension.End.Row)
            {
                return(null);
            }

            // Currently setting Min and Max for segment is hard coded as 0, 100, since these values are not present in excel
            int segmentMinOccur = 0;
            int segmentMaxOccur = 100;
            int loopMinOccur    = 0;
            int loopMaxOccur    = 100;

            XmlFileSchemaRow currentRow = ReadRow(schemaWorksheet, row) as XmlFileSchemaRow;
            XmlFileSchemaRow nextRow    = ReadRow(schemaWorksheet, row + 1) as XmlFileSchemaRow;

            IPluglet nextNode  = null;
            IPluglet childNode = null;

            if (nextRow.IsLeafNode)
            {
                segmentMinOccur = string.Compare(currentRow.MandatoryFlag, "Y", true) == 0 ? 1 : 0;
                segmentMaxOccur = string.Compare(currentRow.MandatoryFlag, "N", true) == 0 ? 0 : 1000;
                // If next row contains leaf node then we need to construct segment
                nextNode = new Pluglet(
                    new PlugletInput()
                {
                    Name            = currentRow.ElementName,
                    Definition      = currentRow.ElementName,
                    Type            = PlugletType.Segment,
                    Parent          = null,
                    MinOccurs       = segmentMinOccur,
                    MaxOccurs       = segmentMaxOccur,
                    IsTagSameAsName = true,                 // for XML spec cert tag is always same as name
                });

                IPluglet dataPluglet = null;

                // Now read all data elements
                currentRow = nextRow;
                ++row;
                while (currentRow != null && currentRow.Level == currentLevel + 1)
                {
                    if (currentRow.IsLeafNode)
                    {
                        ++row;
                        int  minOccurs, maxOccurs;
                        bool isIgnore;

                        // TODO: What about mandatory flag value 'X'?
                        minOccurs = string.Compare(currentRow.MandatoryCode, "M", true) == 0 && string.Compare(currentRow.MandatoryFlag, "Y", true) == 0 ? 1 : 0;
                        maxOccurs = string.Compare(currentRow.MandatoryFlag, "N", true) == 0 ? 0 : 1;
                        isIgnore  = string.Compare(currentRow.IgnoreFlag, "I", true) == 0;

                        dataPluglet = new Pluglet(
                            new PlugletInput()
                        {
                            Name            = currentRow.ElementName,
                            Definition      = currentRow.ElementName,
                            Type            = PlugletType.Data,
                            Parent          = nextNode,
                            MinOccurs       = minOccurs,
                            MaxOccurs       = maxOccurs,
                            IsIgnore        = isIgnore,
                            IsTagSameAsName = true,         // for XML spec cert tag is always same as name
                        });

                        dataPluglet.DataType = ReadDataType(currentRow, schemaWorksheet, nextNode.Path, ref row);
                    }
                    else
                    {
                        childNode = GetNextNode(schemaWorksheet, currentLevel + 1, ref row);
                        nextNode.Children.Add(childNode);
                        childNode.Parent = nextNode;
                    }

                    currentRow = ReadRow(schemaWorksheet, row) as XmlFileSchemaRow;
                }
            }
            else
            {
                // If next row contains non-leaf node then we need to construct loop element
                nextNode = new Pluglet(
                    new PlugletInput()
                {
                    Name            = currentRow.ElementName,
                    Definition      = currentRow.ElementName,
                    Type            = PlugletType.Loop,
                    Parent          = null,
                    MinOccurs       = loopMinOccur,
                    MaxOccurs       = loopMaxOccur,
                    IsTagSameAsName = true,                 // for XML spec cert tag is always same as name
                });

                ++row;

                // Read all child elements (level is > current level)
                while (nextRow != null && nextRow.Level > currentLevel)
                {
                    childNode = GetNextNode(schemaWorksheet, currentLevel + 1, ref row);

                    nextNode.Children.Add(childNode);
                    childNode.Parent = nextNode;

                    nextRow = ReadRow(schemaWorksheet, row) as XmlFileSchemaRow;
                }
            }

            // Do we need this for xml cert files?
            // FillInMissingChildren(segment);

            return(nextNode);
        }