Exemplo n.º 1
0
 public XmlParser(string fileAddress) : base(fileAddress)
 {
     flagsOfTheState = new FlagsOfTheState();
     parsingElement  = new StringBuilder();
     StackWithTags   = new Stack <string>();
     Result          = new XmlParserResult(StackWithTags);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Method GetTypeOfTag
        /// Gives type tag.
        /// </summary>
        /// <param name="XmlString">XML file is translated into a string.</param>
        /// <param name="flagsOfTheState">The current state of the parser.</param>
        /// <param name="index">The index of the character being processed.</param>
        public void GetTypeOfTag(string XmlString, FlagsOfTheState flagsOfTheState, ref int index)
        {
            flagsOfTheState.TagFlag = true;
            // Separates the tag from the closing tag.
            if (XmlString[index + 1] == '/')
            {
                index++;
                flagsOfTheState.ClosingTagFlag = true;
            }

            // Separates the tag from the comment.
            if ((XmlString[index + 1] == '!') && (XmlString[index + 2] == '-') && (XmlString[index + 3] == '-'))
            {
                index += 3; // Skipping, the character of the start of the comment (<!--).
                flagsOfTheState.CommentFlag = true;
                flagsOfTheState.TagFlag     = false;
            }
        }