<html><body><div style="color:#000; background-color:#fff; font-family:tahoma, new york, times, serif;font-size:10pt"><div style="font-size: 10pt; font-family: tahoma, 'new york', times, serif; ">Greetings all,</div><div style="font-size: 10pt; font-family: tahoma, 'new york', times, serif; "><br></div><div style="font-size: 10pt; font-family: tahoma, 'new york', times, serif; ">I'm a bit stumped by some of the STP functions and usage. The documentation is, well, a bit sparse, so it's not clear whether there really is a bug or I'm mis-interpreting what I'm reading. Here is a simple function that should return all the child nodes of an element with the local-name of 'RegressionModel':</div><div style="font-size: 10pt; font-family: tahoma, 'new york', times, serif; "><br></div><div style="font-size: 10pt; "><div style="font-family: tahoma, 'new york', times, serif; ">(defun function-name (document)</div><div style="font-family: tahoma, 'new york', times,
serif; "> "Return the PMML model type of the document"</div><div style="font-family: tahoma, 'new york', times, serif; "> (stp:filter-recursively (stp:of-name "RegressionModel") (stp:first-child document)))</div><div style="font-family: tahoma, 'new york', times, serif; "><br></div><div>According to the documentation of <a href="http://www.lichteblau.com/cxml-stp/doc/pages/cxml-stp__fun__filter-recursively.html"><font class="Apple-style-span">filter-recursively</font></a>:</div></div><blockquote class="webkit-indent-blockquote" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><div><div><font class="Apple-style-span" face="verdana, helvetica, sans-serif" size="1">Return a list of descendant nodes of <tt>node</tt> in pre-order, from which nodes that
do not satisfy <tt>predicate</tt> have been removed.</font></div></div></blockquote><font class="Apple-style-span" size="1"><font class="Apple-style-span" face="verdana, helvetica, sans-serif">and that for </font><a href="http://www.lichteblau.com/cxml-stp/doc/pages/cxml-stp__fun__of-name.html"><font class="Apple-style-span">of-name</font></a><font class="Apple-style-span" face="verdana, helvetica, sans-serif">:</font></font><blockquote class="webkit-indent-blockquote" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><div><font class="Apple-style-span" face="verdana, helvetica, sans-serif" size="1"><span class="Apple-style-span" style="font-family: verdana, arial; font-size: 11px; ">This function creates a test function for nodes of this name.<br><br>The
function returned will return T if the argument is an instance of <a href="http://www.lichteblau.com/cxml-stp/doc/pages/cxml-stp__class__attribute.html" style="text-decoration: none; color: black; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(0, 112, 160); "><tt>attribute</tt></a> or <a href="http://www.lichteblau.com/cxml-stp/doc/pages/cxml-stp__class__element.html" style="text-decoration: none; color: black; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(0, 112, 160); "><tt>element</tt></a> and has the specified local-name and namespace URI, and will return NIL otherwise.<br><br>If local-name is nil, only the namespace URI is considered for comparison.</span><br></font></div></blockquote><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;">and here's the local snippet of the xmls that I'm trying to filter
for:</span></font></div><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><blockquote class="webkit-indent-blockquote" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;"><div>#.(CXML-STP:ELEMENT</div><div> #| :PARENT of type ELEMENT |#</div><div> :ATTRIBUTES '(#.(CXML-STP:ATTRIBUTE</div><div> #| :PARENT of type ELEMENT |#</div><div> :VALUE "PolynomialRegression"</div><div>
:LOCAL-NAME "algorithmName")</div><div> #.(CXML-STP:ATTRIBUTE</div><div> #| :PARENT of type ELEMENT |#</div><div> :VALUE "regression"</div><div> :LOCAL-NAME "functionName")</div><div> #.(CXML-STP:ATTRIBUTE</div><div> #| :PARENT of type ELEMENT |#</div><div> :VALUE "KNIME Polynomial Regression"</div><div> :LOCAL-NAME
"modelName")</div><div> #.(CXML-STP:ATTRIBUTE</div><div> #| :PARENT of type ELEMENT |#</div><div> :VALUE "s_s_temp"</div><div> :LOCAL-NAME "targetFieldName"))</div><div> :BASE-URI "file://+/Users/nunez/src/lisp/pmml/polynomial-regression.xml"</div><div> :CHILDREN '(#.(CXML-STP:TEXT</div><div> #| :PARENT of type ELEMENT |#</div><div> :DATA "</div><div> ")</div></span></font></div></blockquote><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size:
11px;">So, there's an attribute with a local-name that matches the value in of-name. Why is this function always returning NIL?</span></font><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;">Is stp stable enough for production use? It's been a while since it's been updated. I'm new to XML with LISP, so if there's a better documented or easier way to process these documents, happy to take a different route.</span></font></div><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;">Finally, does anyone know why I need to pass the function the first child? Seem
cxml-stp is getting tripped up on the first line of the xml file: <?xml version="1.0" encoding="UTF-8"?> and forcing me to manually grab the second element. Is there a convention or idiom I'm missing?</span></font></div><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;">Sample file attached.</span></font></div><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;">Cheers,</span></font></div><div><font class="Apple-style-span" face="verdana, arial"><span class="Apple-style-span" style="font-size: 11px;"> -
Steve</span></font></div></div></body></html>