Support skipping root node when flattening tree