public void Visit(Tag tag, IElement parent, IEnumerable<IElement> children) { if (this.root == null) { this.root = tag.ToXElement(); } else { var newRoot = tag.ToXElement(); newRoot.Add(this.root); this.root = newRoot; } }
public void Visit(Tag tag, IEnumerable<IElement> children) { var xElementFromTag = tag.ToXElement(); if (root == null) { root = xElementFromTag; this.actualElement = root; } else { this.actualElement.Add(xElementFromTag); } var previous = this.actualElement; this.actualElement = xElementFromTag; ChildrenTags(children); this.actualElement = previous; }