public XmlParser(string receivedString) { ParsedResult = new List <string>(); XmlAddress = receivedString; flagsOfTheState = new FlagsOfTheState(); parsingElement = new StringBuilder(); StackWithTags = new Stack <string>(); Argument = new Argument(StackWithTags, ParsedResult, flagsOfTheState); }
/// <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; } }
/// <param name="stackWithTags">Stack with the corresponding tags.</param> /// <param name="parsedResult">List with parsed arguments.</param> /// <param name="flagsOfTheState">The current state of the parser.</param> public Argument(Stack <string> stackWithTags, List <string> parsedResult, FlagsOfTheState flagsOfTheState) { StackWithTags = stackWithTags; ParsedResult = parsedResult; this.flagsOfTheState = flagsOfTheState; }
public XmlDeclarationTag(FlagsOfTheState flagsOfTheState, string tag) { this.flagsOfTheState = flagsOfTheState; this.ActualTag = tag; }