The XD document is represented as a hierarchical tree of nodes called the scenegraph. Some scenenodes may contain children (e.g. a Group or Artboard), while others are leaf nodes (e.g. a Rectangle or Text node).
Typically, you access scenegraph nodes via the selection
argument that is passed to your plugin command.
You can modify properties on any scenenodes within the current edit context (see below), and you can add leaf nodes to the edit context, but you cannot make structural changes directly to the scenegraph tree - e.g. reordering nodes or changing nesting. To do this, instead use commands.