public void CleanAttributes(TreeRoot root) { AttributeCleaner cleaner = new AttributeCleaner(); TreeNode current = root.Child; CleanAttributesChild(current, cleaner); }
public void CheckForNotClosedTags(TreeRoot root) { TreeNode current = root.Child; current.Closed = true; CheckForNotClosedTagsChild(current, root); }
public void RemoveUnwantedTags(TreeRoot root) { TagCleaner cleaner = new TagCleaner(); TreeNode current = root.Child; RemoveUnwantedTagChild(current, cleaner, root); }
void BuildTree(string file) { var root = new TreeRoot(); root.BuildTree(file); roots.Add(root); }
public void GenerateFile(TreeRoot root) { File.Move(root.FilePath, root.FilePath + "_copy"); current_level++; using (StreamWriter writer = new StreamWriter(root.FilePath)) { writer.WriteLine(root.Doctype); this.SetDataForNodeFile(root.Child, writer); } }
public void GenerateOutput(TreeRoot root) { if (root == null) { Logger.WriteLine("Plik nie został załadowany"); } else { OutputGenerator generator = new OutputGenerator(); generator.Generate(root); } }
void RemoveUnwantedTagChild(TreeNode node, TagCleaner cleaner, TreeRoot root) { if (cleaner.TagRemover(node) != 1) { try { foreach (TreeNode current in node.Children) { RemoveUnwantedTagChild(current, cleaner, root); } } catch { RemoveUnwantedTags(root); } } }
void CheckForNotClosedTagsChild(TreeNode node, TreeRoot root) { if (!node.Closed) { if (Dictionaries.Instance.TagWithOptionalClosing.ContainsKey(node.Name)) { Logger.WriteLine("[" + Path.GetFileName(root.FilePath) + "]" + "Warning! The " + node.Name + " tag which starts at " + node.LineNumber + " line should have closing"); } else { throw new Exception("[" + Path.GetFileName(root.FilePath) + "]" + "Error! The " + node.Name + " tag which starts at " + node.LineNumber + " line does not have closing"); } } foreach (TreeNode current in node.Children) { CheckForNotClosedTagsChild(current, root); } }
public void GenerateInLogger(TreeRoot root) { Logger.WriteLine(root.Doctype); this.SetDataForNodeLogger(root.Child); }