public XMLTag CreateCopy() { XMLTag Copy = new XMLTag(this.Name); Copy.Content = this.Content; Copy.ChildrenNodes = this.ChildrenNodes.Select(node => node.CreateCopy()).ToList(); Copy.Attributes = this.Attributes.Select(attr => attr.CreateCopy()).ToList(); return(Copy); }
public override bool AddFileContent(File File, string Content) { bool Success = ValidFileType(File); if (Success) { XMLFile XMLFile = (XMLFile)File; XMLFile.Encoding = "UTF-16"; XMLFile.XMLVersion = 1.3F; XMLFile.RootNode = new XMLTag("root"); XMLTag Sentences = new XMLTag("sentences"); Sentences.Attributes.Add(new XMLTagAttribute("count", "2")); XMLFile.RootNode.ChildrenNodes.Add(Sentences); XMLTag Sentence1 = new XMLTag("sentence"); Sentences.ChildrenNodes.Add(Sentence1); Sentence1.Content = "Dnes je pekne."; XMLTag Sentence2 = new XMLTag("sentence"); Sentences.ChildrenNodes.Add(Sentence2); Sentence2.Content = "Zajtra je skôr nepekne."; } return(Success); }