xml-xalan-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Smeeta Jalan" <smeeta.ja...@gmail.com>
Subject XercesDOMWrapperException
Date Fri, 28 Apr 2006 15:34:30 GMT
Hi,

I have tried so many ways to convert a XalanNode to a DOMNode but I get
stuck at some point or the other. First I was getting error in the
constructor of XercesDocumentWrapper, so I switched to obtaining a wrapper
via XercesParserLiaison.

Now it's giving me XercesDOMWrapperException at the last line in the mapNode
function. The documentation says:
If the node not owned by this document, the function will throw
XalanDOMException<http://xml.apache.org/xalan-c/apiDocs/classXalanDOMException.html>with
the code WRONG_DOCUMENT_ERR.
But I have already used the createDocument function. Doesn't that suffice?

Could somebody please look into my code and point out where am I wrong?

My Code:

(dom_document_ is an instance of DOMDocument created through DOMBuilder
using Xerces.)

    XalanNode* const    result = evaluator.selectSingleNode(
      dom_support_,
            xalan_document_,
            XalanDOMString(xpath).c_str(),
            prefix_resolver);


    XercesParserLiaison xerces_parser_liaison;
    XercesDocumentWrapper *document_wrapper =
xerces_parser_liaison.mapDocumentToWrapper(xerces_parser_liaison.createDocument(dom_document_,
true, true, true));
    assert (document_wrapper != 0);

    //Iterate through the node list
    size_t nodelist_len =  result.getLength();
    if (nodelist_len <= 0) {
      return -1;
    }
    else if (nodelist_len == 1) {
     if(IsBadWritePtr (outnode, sizeof(outnode))) {
        return -1;
      }
      cout<<result->getNodeName();
      DOMNode *xernode = (DOMNode*)(document_wrapper->mapNode(result));


Thanks,
Smeeta

Mime
View raw message