You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by sp...@pusan.ac.kr on 2002/03/27 07:51:16 UTC
I don't use a node test, "text()."
Q1>
I use a xalan's xpath dll, and evaluate expression,
"SimpleXPathAPI personal.xml / descendant::email/self::text()".
The result of above execution is null.
and "SimpleXPathAPI personal.xml / count(descendant::email/self::text())"
is 'Exception caught!'.
Why?
Q2>
If the result of expression evaluation is a node-set, How I access each node of node-set?
const XObjectPtr theResult(
theEvaluator.evaluate(
theDOMSupport,
theContextNode,
XalanDOMString(argv[3]).c_str(),
theDocument->getDocumentElement()));
assert(theResult.null() == false);
if(theResult->getType() == XObject::eTypeNodeSet)
{
.... <-- I don't know this code...
}
-----------------------------------------------
personal.xml
Boss Big
chief@foo.com
Worker One
one@foo.com
Worker Two
two@foo.com
Worker Three
three@foo.com
Worker Four
four@foo.com
Worker Five
five@foo.com
-----------------------------------------
personal.dtd
------------------------------------------
Re: I don't use a node test, "text()."
Posted by Wolfgang Schell <wo...@gmx.de>.
> Q2>
> If the
> result of expression evaluation is a node-set, How I acc
> ess each node of node-set?
>
> const XObjectPtr theResult
> (
> theEvaluator.evaluate(
> theDOMSupport,
>
> theContextNode,
> XalanDOMString(argv[3])
> .c_str(),
> theDocument->getDocumentElement()));
>
> assert(theResult.null() == false);
>
> if(theResult->getType() == XObject::eTypeNodeSet)
> {
const NodeRefListBase& nl = xPtr->nodeset();
// iterate over all nodes
for (NodeRefListBase::size_type ii = 0; i < nl.getLength(); i++) {
XalanNode* pNode = nl.item(i);
// do something with node
}
> }
Cheers,
Wolfgang
--
Wolfgang Schell
wolfgang.schell@gmx.de
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net