The most straightforward way of loading a tree straight from XML would be to create a BTAsset and set the XML on it, then you can assign that to any AI’s BasicMind.
I made this custom script to load arbitrary tree XML (I generated my test XML from an actual tree in the editor):
using RAIN.BehaviorTrees;
using RAIN.Core;
using RAIN.Minds;
using System.Collections.Generic;
using UnityEngine;
public class CustomTreeLoader : MonoBehaviour
{
[SerializeField]
private TextAsset _treeXML;
void Start()
{
// Create the asset
BTAsset tCustomAsset = ScriptableObject.CreateInstance<BTAsset>();
// Assign the tree xml, mine was exported from another tree and saved within my project
tCustomAsset.SetTreeData(_treeXML.text);
// You don't have to set these if they are empty, just here for example
tCustomAsset.SetTreeBindings(new string[0] { });
// My rig was on the same object
AIRig tRig = GetComponentInChildren<AIRig>();
((BasicMind)tRig.AI.Mind).SetBehavior(tCustomAsset, new List<BTAssetBinding>());
}
}