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()" );