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