Hi,

I have 2 problems / questions

1.

I'm trying to process the child nodes of an element node that was
selected with the use of an evaluator but, although hasChildNodes
returns true, when I try to process the child nodes I always get an
error as if the nodes don't have any callable methods

Here's the code :

----- snip ------

XalanDOMString cFileName = TranscodeFromLocalCodePage(strFile.c_str());
LocalFileInputSource cInputSource(cFileName.c_str());
XalanSourceTreeInit cSourceTreeInit;
XalanSourceTreeDOMSupport cDOMSupport;
XalanSourceTreeParserLiaison cLiaison(cDOMSupport);

cDOMSupport.setParserLiaison(&cLiaison);
                                
XalanDocument * pDocument = cLiaison.parseXMLStream(cInputSource);
XalanDocumentPrefixResolver     cPrefixResolver(pDocument);
XPathEvaluator cEvaluator;

XalanElement * pParentNode = 
        reinterpret_cast<XalanElement
*>(cEvaluator.selectSingleNode(cDOMSupport,
                                                                                
     pDocument,
   TranscodeFromLocalCodePage(XMLP_PARENT.c_str()).c_str(),
                                                                    
cPrefixResolver));

if (pParentNode->hasChildNodes())
{
    XalanNodeList * pListNodes = pParentNode->getChildNodes();

        for (xalanc::size_type i = 0; i < pListNodes->getLength(); ++i)
        {
            const XalanDOMString & strXNodeName =
pListNodes->item(i)->getNodeName();

            switch (pListNodes->item(i)->getNodeType())
            {
              .....
            }
      }
}

---- snip ---

Do I do something wrong ? Do I have to use some transformation in
order to process the child nodes without finding them ?

Interesting enough, if I process the nodes by finding them with the
evaluator, then everything is Ok.

2. I'm trying to find all CDATA nodes in an XML document and I don't
know how should I formulate the query for the evaluator. Any
suggestions ?

Thanks,
Ken

Reply via email to