private void ParseFindElement(LookaheadEnumerator <XmlSimpleReader.XmlElement> xmlReader)
 {
     XmlSimpleReader.XmlStartElement findElement = this.ReadElement(xmlReader, "find");
     this.HasAutoWhereAttrOnly(findElement);
     this.ReadEndElement(xmlReader, "find");
     //SELECT文を取得する
     _findSql = findElement.Contents;
 }
 private void ParseCountElement(LookaheadEnumerator <XmlSimpleReader.XmlElement> xmlReader)
 {
     XmlSimpleReader.XmlStartElement countElement = this.ReadElement(xmlReader, "count");
     this.HasAutoWhereAttrOnly(countElement);
     this.ReadEndElement(xmlReader, "count");
     //COUNT文を取得する
     _countSql = countElement.Contents;
 }
        private void ParseSqlEntryElement(LookaheadEnumerator <XmlSimpleReader.XmlElement> xmlReader)
        {
            XmlSimpleReader.XmlStartElement sqlEntryElement = this.ReadElement(xmlReader);
            if (sqlEntryElement.HasAttributes)
            {
                throw new BadFormatSqlPodException("sqlエントリタグに属性は指定できません");
            }
            _definedSqlEntries.Add(sqlEntryElement);

            //SQL文を取得する
            _entrySqls[sqlEntryElement.Name] = sqlEntryElement.Contents;

            this.ReadEndElement(xmlReader, sqlEntryElement.Name);
        }
 private void ReadEndElement(LookaheadEnumerator <XmlSimpleReader.XmlElement> xmlReader
                             , string elementName = null)
 {
     if (!xmlReader.MoveNext())
     {
         throw new BadFormatSqlPodException("予期しないEndOfFileです");
     }
     XmlSimpleReader.XmlElement element = xmlReader.Current;
     if (elementName != null && element.Name != elementName)
     {
         throw new BadFormatSqlPodException("予期しないXMLタグです");
     }
     else if (!(element is XmlSimpleReader.XmlEndElement))
     {
         throw new BadFormatSqlPodException("XMLの終了タグが見つかりません");
     }
 }
        private bool NextElementIsSqlEntry(LookaheadEnumerator <XmlSimpleReader.XmlElement> xmlReader)
        {
            if (xmlReader.Next == null || !(xmlReader.Next is XmlSimpleReader.XmlStartElement))
            {
                return(false);
            }

            foreach (XmlSimpleReader.XmlElement sqlEntryElement in _definedSqlEntries)
            {
                if (sqlEntryElement.Name == xmlReader.Next.Name)
                {
                    throw new BadFormatSqlPodException("SqlPodXMLののSqlエントリタグの名称が重複しています");
                }
            }

            return(true);
        }
        private void ParseSqlPodElement(LookaheadEnumerator <XmlSimpleReader.XmlElement> xmlReader)
        {
            this.ReadElement(xmlReader, "sqlPod");

            this.ParseFindElement(xmlReader);

            if (this.NextElementIs(xmlReader, "count"))
            {
                this.ParseCountElement(xmlReader);
            }

            while (this.NextElementIsSqlEntry(xmlReader))
            {
                this.ParseSqlEntryElement(xmlReader);
            }

            this.ReadEndElement(xmlReader, "sqlPod");
        }
 private bool NextElementIs(LookaheadEnumerator <XmlSimpleReader.XmlElement> xmlReader, string elementName)
 {
     return(xmlReader.Next != null &&
            xmlReader.Next is XmlSimpleReader.XmlStartElement &&
            xmlReader.Next.Name == elementName);
 }