David Bertoni wrote:
> 
> You have to _start_ with an instance of Xerces-C's DOMDocument, and wrap 
>   it for use in Xalan-C:
> 
> const xercesc_2_7::DOMNode*
> foo(
>      xercesc_2_7::DOMDocument *dom_document_,
>      const XMLCh*              xpath)
> {
>      XALAN_USING_XALAN(XalanDOMString)
>      XALAN_USING_XALAN(XalanDocument)
>      XALAN_USING_XALAN(XalanElement)
>      XALAN_USING_XALAN(XalanNode)
>      XALAN_USING_XALAN(XercesDOMSupport)
>      XALAN_USING_XALAN(XercesParserLiaison)
>      XALAN_USING_XALAN(XPathEvaluator)
>      XALAN_USING_XALAN(ElementPrefixResolverProxy)
>      XALAN_USING_XALAN(XercesDocumentWrapper)
> 
>      XercesDOMSupport      theDOMSupport;
>      XercesParserLiaison   theParserLiaison(theDOMSupport);
> 
>      XalanDocument*  theDocument =
>          theParserLiaison.createDocument(
>                   dom_document_,
>                   true,
>                   true,
>                   true,
>                   true);
> 
>      XPathEvaluator  theEvaluator;
> 
>      const XalanElement* const   theRootElement =
>          theDocument.getDocumentElement();
> 
>      ElementPrefixResolverProxy thePrefixResolver(theRootElement);
> 
>      XalanNode* const  theNode =
>       theEvaluator.selectSingleNode(
>              theDOMSupport,
>              theDocument,
>           XalanDOMString(xpath).c_str(),
>           prefix_resolver);
> 
>      XercesDocumentWrapper* const    theWrapper =
>          theParserLiaison.mapDocumentToWrapper(theDocument);
> 
>      return theWrapper->mapNode(theNode);
> }
> 
Hi,
 In the above piece of code if Foo has to return XalanDocument then how can
it be achieved? I mean "theParserLiaison" has the ownership of XalanDocument
as per documentation. So once i return for the Foo function
"theParserLiaison" will go out of scope destroying XalanDocument whihc it
created.So what can be done in that case?
-- 
View this message in context: 
http://www.nabble.com/XalanDocument-and-DOMDocument-Interchange-tf1530799.html#a12814910
Sent from the Xalan - C - Users mailing list archive at Nabble.com.

Reply via email to