void EndData(Text containerClass) { if (currentData.Count > 0) { string data = currentData.Aggregate(new StringBuilder(), (x, y) => x.Append(y)).ToString(); char[] spaceChars = { (char)9, (char)10, (char)12, (char)13, (char)32 }; if (string.IsNullOrEmpty(new string(data.Where(c => !spaceChars.Contains(c)).ToArray()))) { if (preserveWhitespaceTags.Intersect(TagStack.Select(tag => tag.TagName)).Count() == 0) { if (data.Contains("\n")) { data = "\n"; } else { data = " "; } } } currentData = new List<string>(); Text o = containerClass; o.Value = data; o.Setup(currentTag, Root.Previous); if (Root.Previous != null) { Root.Previous.Next = o; } Root.Previous = o; currentTag.AddChild(o); } }
void ToStringSubClass(string text, Text p) { EndData(); HandleData(text); EndData(p); }