root property

XmlNode root

Return the root of the tree in which this node is found, whether that's a document or another element.

Implementation

XmlNode get root {
  var current = this;
  while (current.parent != null) {
    current = current.parent!;
  }
  return current;
}