Hi,

It looks like you're not initializing Xerces-C, which is required.  Take a
look at any of the sample programs for more information.

Dave



                                                                                
                                                      
                      Francesc Guim                                             
                                                      
                      Bernat                   To:      
[email protected]                                                  
                      <[EMAIL PROTECTED]         cc:      (bcc: David N 
Bertoni/Cambridge/IBM)                                          
                      s>                       Subject: Getting in troubles 
problems using Xerces 2.4 and Xalan 1.7.                  
                                                                                
                                                      
                      05/01/2004 05:36                                          
                                                      
                      AM                                                        
                                                      
                      Please respond                                            
                                                      
                      to xalan-c-users                                          
                                                      
                                                                                
                                                      



Dear Colleagues,
    I'm trying to use Xalan and Xerces together, nevertheless i'm not
able to run succesfully any of the codes that i've developed. I'm always
getting and exception when the XalanSourceTreeParserLiaison or
XercesParserLiaison are used (the exception is not and
XalanDOMExcpetion, XSLException or DOMExcpetion). Also, when i'm running
one of samples of the Xalanc source code provided by the library, the
sample XPathWrapper, an exception is triggered. I don't how to solve
this problem, i've tried many things but i'm always fail.... actually,
i'm not too sure of what would be the error... I'm using Xerces 2.4 and
Xalan 1.7.

Anyone can orient me ? what i'm doing wrong ? I atach my source code at
the end of this mail.

i will be thankful for any help

cheers,

Francesc

LISTMSG XMLeanDBStatisticMsg::selectMsgs(char* selector)
{

    LISTMSG llista;

    XPathEvaluator::initialize();

    XalanSourceTreeDOMSupport        theDOMSupport;
    this->document->normalize();

    XercesParserLiaison * Liasion = new XercesParserLiaison();

    XalanDocument* proxyDocument;
    XalanElement* xalContextNode ;

    try
    {
        proxyDocument = Liasion->createDocument(this->document);
        xalContextNode = proxyDocument->getDocumentElement();
    }
    catch(XalanDOMException& error)
    {
        return llista;
    }

    XPathEnvSupportDefault            theEnvSupport;
    XObjectFactoryDefault            theXObjectFactory;
    XPathExecutionContextDefault    theExecutionContext(theEnvSupport,
theDOMSupport, theXObjectFactory);
    XPathConstructionContextDefault    theXPathConstructionContext;
    XPathFactoryDefault                theXPathFactory;
    XPathProcessorImpl                theXPathProcessor;

    try
    {
        XPath* const    xpath = theXPathFactory.create();
        theXPathProcessor.initXPath(*xpath,
                            theXPathConstructionContext,
                            XalanDOMString(selector),
                            ElementPrefixResolverProxy(xalContextNode,
theEnvSupport, theDOMSupport));

        XObjectPtr xObj = xpath->execute(xalContextNode,
                              ElementPrefixResolverProxy(xalContextNode,
theEnvSupport, theDOMSupport),
                              theExecutionContext);

        XalanNode* primer;
        DOMNode * actual;

        const NodeRefListBase&    resultat = xObj->nodeset();
        XercesDocumentWrapper * theWrapper =
Liasion->mapDocumentToWrapper(proxyDocument);

        for(unsigned int i=0;i<resultat.getLength();i++)
        {
            primer = resultat.item(i);
            //Un cop es te l'element el modifiquem afegint-hi un atribut.
            actual = (DOMElement*)(theWrapper->mapNode(resultat.item(i)));
            //Creem un element del tipus XMLeanDBStatisticMsg i l'afegim
a la llista
            XMLeanStatisticMsg * nou = new XMLeanStatisticMsg(actual);
            llista.push_back(nou);
        }
    }
    catch(XalanDOMException& error)
    {
        return llista;
    }
    catch(XSLException& error)
    {
        XalanDOMString er = error.getMessage();
        return llista;
    }
    catch (...)
    {
        return llista;
    }


    return llista;
}



Reply via email to