I have learned scripting just by scripting (the way I script is that I try a lot of different things, read documentation (for JSL usually in this order: Scripting Index, Scripting Guide, JMP Community, JSL Syntax Reference) and try more things and fail a lot, but in the end I almost always manage to get some kind of working solution).
I think you can send << get xml to either analytical or report layer of jmp object. Sometimes you can even get to closer to correct reference by first subscripting and then using << get xml, but in this case I did just send it to gb. Below is other example with Big Class.jmp and after that where I placed in your script. Usually I clear log, run << get xml line, click on log and then use ctrl+f to search something (if I know what I'm looking for). If you have to explore some very large XML it might be helpful to save the xml as .xml file and open it with some application which has syntax highlighting for xml (notepad++ is usually enough).
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Select Rows([1, 2]) << Hide and Exclude(1) << Clear Select;
gb = dt << Graph Builder(
Size(528, 456),
Show Control Panel(0),
Variables(X(:weight), Y(:height), Overlay(:sex)),
Elements(Points(X, Y, Legend(9)), Smoother(X, Y, Legend(10)))
);
// Report(gb) << Get Xml; // works also on report
gb << Get XML; // run just this line to see xml in log or use Write() (write is the cleanest option)
// Write(gb << Get XML);
// xml_str = gb << get xml;
// show(xml_str);
where_tb = Report(gb) << XPath("//TextBox[contains(text(), 'Where(')]");
where_tb << Text Color("Blue"); // usually used to hide where text << Set Visibility("Collapse");
and here is where I would place << Get XML in your script, run it once, check the xml and then remove the line from code as there usually is no point in leaving << Get XML to ready made scripts.
-Jarmo