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 Amit Dang <am...@intersolutions.stpn.soft.net> on 2005/06/09 12:04:45 UTC

How to get Xalan Nodes from NodeRefList

Hi All,
    I am using Xalan 1.9 and am stuck with the problem "How to get Xalan
Nodes from NodeRefList". Following is the code which am using.


char* mlpXmlEvent = "<TestCase><TestCaseDetail
no='1'></TestCaseDetail><TestCaseDetail
no='2'></TestCaseDetail></TestCase>";
char* mlpEventRoot = "TestCase";
XalanSourceTreeDOMSupport   mTheDOMSupport;
XalanSourceTreeParserLiaison* mpTheLiaison;
XalanDocument* mpTheDocumentPtr;
XPathEvaluator theEvaluator;
mpTheLiaison = new XalanSourceTreeParserLiaison(mTheDOMSupport);
mTheDOMSupport.setParserLiaison(mpTheLiaison);
MemBufInputSource* pMemBufIS = new MemBufInputSource((const
XMLByte*)mlpXmlEvent,
                            strlen(mlpXmlEvent), "xEvent", false);
 // Parse the document...
mpTheDocumentPtr = mpTheLiaison->parseXMLStream(*pMemBufIS);

XalanNode* pTheContextNode = theEvaluator.selectSingleNode( mTheDOMSupport,
mpTheDocumentPtr,
                    XalanDOMString(mlpEventRoot).c_str(), 0);
NodeRefList theResult;
theResult  = theEvaluator.selectNodeList(theResult,mTheDOMSupport,
pTheContextNode, XalanDOMString("TestCaseDetail").c_str());

##### How to get XalanNode from 'theResult' i.e. NodeRefList.

Thanks in advance,
Amit


Re: How to get Xalan Nodes from NodeRefList

Posted by Amit Dang <am...@intersolutions.stpn.soft.net>.
Hi David, I am really sorry for that. I misunderstood virtual for pure
virtual. Its working fine.

Thanks,
Amit Dang
----- Original Message ----- 
From: <da...@us.ibm.com>
To: <xa...@xml.apache.org>
Sent: Friday, June 10, 2005 10:49 AM
Subject: Re: How to get Xalan Nodes from NodeRefList


> > Hi Ken, thanks for the fast response. But as per Xalan C++ 1.9 API
> reference
> > item() function is virtual so it can't be used straight away.
>
> Of course it can.  Did you try it and was there a problem?
>
> Dave


Re: How to get Xalan Nodes from NodeRefList

Posted by da...@us.ibm.com.
> Hi Ken, thanks for the fast response. But as per Xalan C++ 1.9 API 
reference
> item() function is virtual so it can't be used straight away.

Of course it can.  Did you try it and was there a problem?

Dave

Re: How to get Xalan Nodes from NodeRefList

Posted by Amit Dang <am...@intersolutions.stpn.soft.net>.
Hi Ken, thanks for the fast response. But as per Xalan C++ 1.9 API reference
item() function is virtual so it can't be used straight away.

Regards,
Amit Dang
----- Original Message ----- 
From: "Ken" <ke...@gmail.com>
To: <xa...@xml.apache.org>
Sent: Thursday, June 09, 2005 4:16 PM
Subject: Re: How to get Xalan Nodes from NodeRefList


> for (xalanc::size_type i = 0; i < theResult.getLength(); ++i)
>  {
>     XalanNode * pNode = theResult.item(i);
>     .....
> }
>
>
> On 6/9/05, Amit Dang <am...@intersolutions.stpn.soft.net> wrote:
> > Hi All,
> >     I am using Xalan 1.9 and am stuck with the problem "How to get Xalan
> > Nodes from NodeRefList". Following is the code which am using.
> >
> >
> > char* mlpXmlEvent = "<TestCase><TestCaseDetail
> > no='1'></TestCaseDetail><TestCaseDetail
> > no='2'></TestCaseDetail></TestCase>";
> > char* mlpEventRoot = "TestCase";
> > XalanSourceTreeDOMSupport   mTheDOMSupport;
> > XalanSourceTreeParserLiaison* mpTheLiaison;
> > XalanDocument* mpTheDocumentPtr;
> > XPathEvaluator theEvaluator;
> > mpTheLiaison = new XalanSourceTreeParserLiaison(mTheDOMSupport);
> > mTheDOMSupport.setParserLiaison(mpTheLiaison);
> > MemBufInputSource* pMemBufIS = new MemBufInputSource((const
> > XMLByte*)mlpXmlEvent,
> >                             strlen(mlpXmlEvent), "xEvent", false);
> >  // Parse the document...
> > mpTheDocumentPtr = mpTheLiaison->parseXMLStream(*pMemBufIS);
> >
> > XalanNode* pTheContextNode = theEvaluator.selectSingleNode(
mTheDOMSupport,
> > mpTheDocumentPtr,
> >                     XalanDOMString(mlpEventRoot).c_str(), 0);
> > NodeRefList theResult;
> > theResult  = theEvaluator.selectNodeList(theResult,mTheDOMSupport,
> > pTheContextNode, XalanDOMString("TestCaseDetail").c_str());
> >
> > ##### How to get XalanNode from 'theResult' i.e. NodeRefList.
> >
> > Thanks in advance,
> > Amit
> >
> >


Re: How to get Xalan Nodes from NodeRefList

Posted by Ken <ke...@gmail.com>.
 for (xalanc::size_type i = 0; i < theResult.getLength(); ++i)
 {
    XalanNode * pNode = theResult.item(i);
    .....
}


On 6/9/05, Amit Dang <am...@intersolutions.stpn.soft.net> wrote:
> Hi All,
>     I am using Xalan 1.9 and am stuck with the problem "How to get Xalan
> Nodes from NodeRefList". Following is the code which am using.
> 
> 
> char* mlpXmlEvent = "<TestCase><TestCaseDetail
> no='1'></TestCaseDetail><TestCaseDetail
> no='2'></TestCaseDetail></TestCase>";
> char* mlpEventRoot = "TestCase";
> XalanSourceTreeDOMSupport   mTheDOMSupport;
> XalanSourceTreeParserLiaison* mpTheLiaison;
> XalanDocument* mpTheDocumentPtr;
> XPathEvaluator theEvaluator;
> mpTheLiaison = new XalanSourceTreeParserLiaison(mTheDOMSupport);
> mTheDOMSupport.setParserLiaison(mpTheLiaison);
> MemBufInputSource* pMemBufIS = new MemBufInputSource((const
> XMLByte*)mlpXmlEvent,
>                             strlen(mlpXmlEvent), "xEvent", false);
>  // Parse the document...
> mpTheDocumentPtr = mpTheLiaison->parseXMLStream(*pMemBufIS);
> 
> XalanNode* pTheContextNode = theEvaluator.selectSingleNode( mTheDOMSupport,
> mpTheDocumentPtr,
>                     XalanDOMString(mlpEventRoot).c_str(), 0);
> NodeRefList theResult;
> theResult  = theEvaluator.selectNodeList(theResult,mTheDOMSupport,
> pTheContextNode, XalanDOMString("TestCaseDetail").c_str());
> 
> ##### How to get XalanNode from 'theResult' i.e. NodeRefList.
> 
> Thanks in advance,
> Amit
> 
>