xPath编码帮助我试图学习/使用xPath从JMP Display Output中检索元素。就我的学习而言,我有一个非常简单的Bivariate输出,并且尝试直接从显示输出中检索Prediction公式。

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检索中的第4个TextBox中检索文本来访问它
zip = (report(ow) << XPath("//TextEditBox"))[4] << get text ;
但是由于下标的值为4,因此如果添加其他拟合值,则可能会更改等。我想使用xPath在具有“线性适合”值的轮廓框之后检索第一个文本框
xPath专家是否有解决方案?
脚本编写回复: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()" );
回复:xPath编码帮助啊哈! 此语法有效!
biv rep << XPath( "//TextEditBox[contains(text(),\!"=\!")]/text()" );
回复:xPath编码帮助超......
我仍然认为必须有一种方法可以在检测到特定的OutlineBox之后从TextEditBox返回值,即在指定的Outline Box之后返回第一个文本框
回复:xPath编码帮助rpt=ow<<REPORT></REPORT>
回复: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语言的观点。 它应该为您完成所有工作。