xPath 编码帮助我正在尝试学习/使用 xPath 从 JMP 显示输出中检索元素。对于我的学习,我有一个非常简单的双变量输出,并且我尝试直接从显示输出检索预测公式。

JSL
names default to here(1);
dt = Open("$Sample_Data/big class.jmp");
ow = Bivariate(
Y( :weight ),
X( :height ),
Fit Line( {Line Color( "Medium Dark Green" )} )
);
问题:
我可以使用显示树调用轻松检索公式
zap = report(ow)["Linear Fit"][TextBox(1)] << get text;
我还可以通过从 xPath 检索中检索第四个文本框的文本来访问它
zip = (report(ow) << XPath("//TextEditBox"))[4] << get text ;
但由于下标的值为 4,如果添加额外的拟合等,可能会发生变化。我想使用 xPath 检索具有“线性拟合”值的轮廓框之后的第一个文本框
xPath 专家有解决方案吗?
自动化和脚本编写数据探索和可视化质量和工艺工程回复:xPath 编码帮助Jim,您可以采用这种方式,但这种方式颠覆了 XPath 语言的意义。 它应该为您完成所有工作。
回复:xPath 编码帮助我发现以下一些其他 xpath 表达式对于导航树结构很有帮助。
// Note: the * in these examples can also be replaced by the class of
// the element you are looking for e.g. TableBox, OutlineBox
rpt = report(ow);
// Gets immediate children of the Outlinebox (ItsTableBox)
rpt << xpath("//OutlineBox[text()='Summary of Fit']/*");
// Gets all descendants of the Outlinebox (TableBox AND all of its ColBoxes)
rpt << xpath("//OutlineBox[text()='Summary of Fit']//*");
// Gets following elements at the same level of the tree
//(Lack of Fit, Analysis of Variances, Parameter Estimates OutlineBoxes)
rpt << xpath("//OutlineBox[text()='Summary of Fit']/following-sibling::*")
// Gets preceding elements at the same level of the tree (TextEditBox with formula)
rpt << xpath("//OutlineBox[text()='Summary of Fit']/preceding-sibling::*")
// Gets ancestors of the box (ListBox, OutlineBox["Linear Fit"], IfBox, OutlineBox["Bivariate Fit..."])
rpt << xpath("//OutlineBox[text()='Summary of Fit']/ancestor::*")这是示例中导航的树结构。

这张海报还有更多例子https://community.jmp.com/t5/Discovery-Summit-2015/JMP-Discovery-2015-Mining-JMP-Reports-v10-pdf/ta-p/22595
回复:xPath 编码帮助非常感谢!回复:xPath 编码帮助rpt=ow<<REPORT></REPORT>
回复:xPath 编码帮助极好的......
我仍然认为必须有一种方法可以在检测到特定 OutlineBox 后从 TextEditBox 返回值,即返回指定 Outline Box 之后的第一个文本框
回复:xPath 编码帮助啊哈! 这个语法有效!
biv rep << XPath( "//TextEditBox[contains(text(),\!"=\!")]/text()" );
回复:xPath 编码帮助您应该能够使用 XPath 完成这一切。 第一个示例为您提供了所有文本。 第二个示例尝试使用 XPath 函数,但我无法使语法正常工作。
Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Bivariate( Y( :weight ), X( :height ), Fit Line( 1 ) );
biv rep = biv << Report;
// get all texts in a list
biv rep << XPath( "//TextEditBox/text()" );
// get specific text
target = "=";
biv rep << XPath( "//TextEditBox/[contains(text(),target)]/text()" );