While attempting to see if this "just works", I find that the call to executionContext.getXObjectFactory().createNodeSet( theNodeList ) results in a runtime error because the getXObjectFactory method returns a reference to the XObjectFactory "interface" (ie the superclass) and therein createNodeSet is a pure virtual (ie abstract) method.
In order for the appropriate XObjectFactory createNodeSet() method to get called, the reference returned from the getXObjectFactory() method has to be cast to the derived XObjectFactoryDefault class which has the implemented version of createNodeSet... (and doesn't having to do so break an OO design principle?) On Tuesday 24 May 2005 05:00 pm, Lonnie VanZandt wrote: > I followed David Bertoni and Mark Weaver's discussion about DynamicBuilders > for returning Documents and ResultTreeFragments from Xalan C++ extension > functions but see no evidence of the new "factory" classes in Xalan C++ 1.9 > sources. I assume that these very attractive changes did not make it in to > any subsequent release. > > So, what is the recommended approach for returning new Document fragments > (I'm attempting to do something nearly identical to the Xalan-J sql > extension and need to construct an RTF to hold the query result data...) > > As you know, the samples sources only add nodes to existing nodesets (eg. > the NodeSet extension). > > I also see use of adding a node to a MutableNodeRefList and perhaps can ask > that node list to add a XalanNode which comes from a wrapped instance of a > XercesDocument which was created by the Xerces DOM document factory. Eg: > > DOMDocument * queryResultDom = > DOMImplementation::getImplementation()->createDocument(0, xmlString, > 0 ); > > // map/wrap/convert the Xerces DOM Document to a suitable Xalan form > // fyi, we can't use a XercesDocumentWrapper directly to create the DOM > // because it is a read-only structure! > XercesDocumentWrapper > xercesDocWrapper(executionContext.getMemoryManager(), > queryResultDom ); > > XPathExecutionContext::BorrowReturnMutableNodeRefList > theNodeList(executionContext); > > theNodeList->addNode( xercesDocWrapper ); > > return > executionContext.getXObjectFactory().createNodeSet(theNodeList); > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
