Return-Path: Delivered-To: apmail-xml-xalan-c-users-archive@www.apache.org Received: (qmail 37962 invoked from network); 28 Apr 2006 15:34:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Apr 2006 15:34:55 -0000 Received: (qmail 20313 invoked by uid 500); 28 Apr 2006 15:34:53 -0000 Delivered-To: apmail-xml-xalan-c-users-archive@xml.apache.org Received: (qmail 20231 invoked by uid 500); 28 Apr 2006 15:34:53 -0000 Mailing-List: contact xalan-c-users-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: xalan-c-users@xml.apache.org List-Id: Delivered-To: mailing list xalan-c-users@xml.apache.org Received: (qmail 20176 invoked by uid 99); 28 Apr 2006 15:34:52 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Apr 2006 08:34:52 -0700 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=HTML_MESSAGE,SPF_PASS,TRACKER_ID X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of smeeta.jalan@gmail.com designates 64.233.182.191 as permitted sender) Received: from [64.233.182.191] (HELO nproxy.gmail.com) (64.233.182.191) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Apr 2006 08:34:52 -0700 Received: by nproxy.gmail.com with SMTP id k27so1554912nfc for ; Fri, 28 Apr 2006 08:34:30 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=UpGUMfCoUz8m8OlFOtuIkgJZ56Dqic6tls5noDvT59hu3ZQ8T5RCTmyG51iQ6WCxctY9nw7TEt0HA/vQq0PI3/qFoErrxBtlk9wEz4kGj4aouy24emNH1e51WVH9gTjCms+AxaTla+Q0aOhndRjPsNOm5yTVjoP2WL63J8pENK4= Received: by 10.49.31.13 with SMTP id i13mr2630158nfj; Fri, 28 Apr 2006 08:34:30 -0700 (PDT) Received: by 10.49.9.19 with HTTP; Fri, 28 Apr 2006 08:34:30 -0700 (PDT) Message-ID: <83e83cec0604280834l427ef595wf2a95d262f40670f@mail.gmail.com> Date: Fri, 28 Apr 2006 21:04:30 +0530 From: "Smeeta Jalan" To: xalan-c-users@xml.apache.org Subject: XercesDOMWrapperException MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_17967_26387577.1146238470375" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_17967_26387577.1146238470375 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 mapNod= e function. The documentation says: If the node not owned by this document, the function will throw XalanDOMExceptionwith 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 =3D evaluator.selectSingleNode( dom_support_, xalan_document_, XalanDOMString(xpath).c_str(), prefix_resolver); XercesParserLiaison xerces_parser_liaison; XercesDocumentWrapper *document_wrapper =3D xerces_parser_liaison.mapDocumentToWrapper(xerces_parser_liaison.createDocu= ment(dom_document_, true, true, true)); assert (document_wrapper !=3D 0); //Iterate through the node list size_t nodelist_len =3D result.getLength(); if (nodelist_len <=3D 0) { return -1; } else if (nodelist_len =3D=3D 1) { if(IsBadWritePtr (outnode, sizeof(outnode))) { return -1; } cout<getNodeName(); DOMNode *xernode =3D (DOMNode*)(document_wrapper->mapNode(result)); Thanks, Smeeta ------=_Part_17967_26387577.1146238470375 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi,

I have tried so many ways to convert a XalanNode to a DOMNode bu= t 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 mapNod= e function. The documentation says:
If the node not owned by this document, the function will throw XalanDOMException with the code WRONG_DOCUMENT_ERR.
But I have already used the createDocument function. Doesn't that suffice?<= br>
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 usi= ng Xerces.)

    XalanNode* const    result =3D evaluator.= selectSingleNode(
      dom_support_,
            xalan_document_,             XalanDOMString(xpa= th).c_str(),
            prefix_resolver);<= br>     
    
    XercesParserLiaison xerces_parser_liaison;
    XercesDocumentWrapper *document_wrapper =3D xerces_parser_liaison.mapDocumentToWrapper(xerces_parser_liaison.createDocu= ment(dom_document_, true, true, true));
    assert (document_wrapper !=3D 0);
      
    //Iterate through the node list
    size_t nodelist_len =3D  result.getLength();
    if (nodelist_len <=3D 0) {
      return -1;
    }
    else if (nodelist_len =3D=3D 1) {
     if(IsBadWritePtr (outnode, sizeof(outnode))) {
        return -1;   &nbs= p;  
      }
      cout<<result->getNodeName();
      DOMNode *xernode =3D (DOMNode*)(document_wra= pper->mapNode(result));
  

Thanks,
Smeeta ------=_Part_17967_26387577.1146238470375--