Ayuda de codificación xPathEstoy intentando aprender / usar xPath para recuperar elementos de la salida de pantalla de JMP.Para mi aprendizaje, tengo una salida bivariada muy simple y estoy intentando recuperar la fórmula de predicción, directamente desde la salida de la pantalla.

El 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" )} )
);
La cuestión:
Puedo recuperar fácilmente la fórmula usando la llamada Display Tree de
zap = report(ow)["Linear Fit"][TextBox(1)] << get text;
También puedo acceder a él recuperando el texto del cuarto TextBox de una recuperación de xPath
zip = (report(ow) << XPath("//TextEditBox"))[4] << get text ;
Pero dado que el valor de 4 para el subíndice, puede cambiar si se agregan ajustes adicionales, etc.Me gustaría usar xPath para recuperar el primer cuadro de texto después de un cuadro de esquema que tiene el valor de "Ajuste lineal"
¿Alguno de ustedes, expertos en xPath, tiene una solución?
ScriptingRe: ayuda de codificación xPathDebería poder hacerlo todo con XPath. El primer ejemplo te da todos los textos. El segundo ejemplo intenta usar una función XPath, pero no puedo hacer que la sintaxis funcione.
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()" );
Re: ayuda de codificación xPath¡Ajá! ¡Esta sintaxis funciona!
biv rep << XPath( "//TextEditBox[contains(text(),\!"=\!")]/text()" );
Re: ayuda de codificación xPathSúper......
Todavía estoy pensando que debe haber una manera de devolver el valor de un TextEditBox después de detectar un OutlineBox específico, gire el primer cuadro de texto después de un Cuadro de esquema especificado
Re: ayuda de codificación xPathrpt=ow<<REPORT></REPORT>
Re: ayuda de codificación xPath¡Muchas gracias!Re: ayuda de codificación xPathAquí hay algunas otras expresiones xpath que he encontrado útiles para navegar por la estructura del árbol.
// 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::*")Esta es la estructura de árbol por la que se navega en los ejemplos.

Este cartel tiene aún más ejemplos https://community.jmp.com/t5/Discovery-Summit-2015/JMP-Discovery-2015-Mining-JMP-Reports-v10-pdf/ta-p/22595
Re: ayuda de codificación xPathPUEDES abordarlo de esa manera, Jim, pero de esa manera se subvierte el sentido del lenguaje XPath. Se supone que hace todo el trabajo por ti.