> SimpleXPathAPI & my app are different.
Yes, but your's needn't be so different from the sample application. You
have modified things which you did not need to modify.
> Here is my sample code. Pls let me know if there is anything wrong.
> I am using xerces parser because I need to read/edit/create the XML
documents
> m_prefXalanDocument =
> m_pXercesParserLiaison->createDocument(m_pDOMDocument,0,1);
m_prefXalanDocument =
m_pXercesParserLiaison->createDocument(m_pDOMDocument,true,true);
> m_pXalanContextNode =
>
m_pXPathEvaluator->selectSingleNode(*m_pXercesDOMSupport,m_prefXalanDocument,
> "/catalog/book".c_str(),*m_pXalanDocumentPrefixResolver);
What compiler are you using? This code cannot possibly compile, unless
your compiler is totally broken.
> m_pXObjectPtr = new
>
XALAN_CPP_NAMESPACE::XObjectPtr((m_pXPathEvaluator->evaluate(*m_pXercesDOMSupport,m_pXalanContextNode,
> "child::[EMAIL PROTECTED]",*m_pXalanDocumentPrefixResolver)));
XObjectPtr is a reference-counting smart pointer. You should never create
one using new.
XObjectPtr m_xobjectPtr =
m_pXPathEvaluator->evaluate(
*m_pXercesDOMSupport,
m_pXalanContextNode,
"child::[EMAIL PROTECTED]",
*m_pXalanDocumentPrefixResolver);
> prefXObject = m_pXObjectPtr->get();
>
This is unnecessary. XObjectPtr has an overloaded operator -> which
returns a pointer to the underlying XObject instance.
> if(XObject::eObjectType::eTypeNodeSet ==
prefXObject->getType())
> {
> NodeRefList pTemp(prefXObject->nodeset());
> iTempCount = pTemp.getLength();
>
> // iTempCount is ZERO
> }
Why are you making a copy of the NodeRefList? Do you need to save it for
some reason?
if(XObject::eObjectType::eTypeNodeSet == xobjectPtr->getType())
{
const NodeRefListBase& pTemp = prefXObject->nodeset();
iTempCount = pTemp.getLength();
// iTempCount is ZERO
}
Without something that will compile, and lacking input data, no one can
possible figure out why your code is not working. If you want someone to
help you, you need to provide a _minimal_ and _complete_ sample that
illustrates the problem.
Dave