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 Judi Thomson <gr...@yahoo.com> on 2001/10/16 18:00:30 UTC
version problems
The code pasted below works as expected using an older
version of xalan and xerces (libraries dated
5/4/2001)
(Actually I borrowed most of the code from an earlier
posting to the list- manyt thanks to the original
author!)
We 'upgraded' to a newer version (libraries dated
8/16/2001) and the same code crashes with an access
violation at the call to theLiason.createDocument().
I can move the point at which I get the access
violation by changing the order of the declarations.
But I simply cannot see how to get rid of it.
any advice greatly appreciated.
Thanks!
Judi Thomson
*****************
// Initialize the XPath subsystem...
XPathInit theInit;
// configure the objects needed for XPath to work
with the Xerces DOM
DOMSupportDefault theDOMSupport;
XercesParserLiaison theLiaison((XercesDOMSupport
&)theDOMSupport);
XPathEnvSupportDefault theEnvSupport;
XObjectFactoryDefault theXObjectFactory;
XPathExecutionContextDefault
theExecutionContext(theEnvSupport,
theDOMSupport,theXObjectFactory);
XPathFactoryDefault theXPathFactory;
XPathProcessorImpl theXPathProcessor;
XalanDocument* const xalanDocument =
theLiaison.createDocument(m_DOMTree);
XercesDocumentBridge* const document_bridge =
theLiaison.mapDocument(xalanDocument);
XalanElement* rootElement =
document_bridge->getDocumentElement();
XalanNode *xalanContextNode =
document_bridge->mapNode(m_DOMTree);
XPath* const xpath = theXPathFactory.create();
theXPathProcessor.initXPath(
*xpath,
TranscodeFromLocalCodePage(expr),
ElementPrefixResolverProxy(rootElement,theEnvSupport,theDOMSupport),
theEnvSupport);
XObjectPtr xObj = xpath->execute(
rootElement,
ElementPrefixResolverProxy(rootElement,theEnvSupport,theDOMSupport),
theExecutionContext);
if (xObj->nodeset().getLength() > 0)
{
{
XalanNode* node = xObj->nodeset().item(0); //we
only want the first one
class DOM_Node returnNode =
document_bridge->mapNode(node);
sText = getValue(returnNode);
}
}
__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com