Link to home
Start Free TrialLog in
Avatar of cybergonzo
cybergonzo

asked on

I use TCppWebBrowser to POST data and receive the resulting page BUT if the result is XML this doesn't work ?


  if (!(!pCppWebBrowser->Busy && pOutputStrings && pCppWebBrowser->Document &&
          String(pCppWebBrowser->LocationURL) != String("about:blank") &&
          SUCCEEDED(pCppWebBrowser->Document->QueryInterface(
          IID_IHTMLDocument2, (LPVOID*)&HTMLDocument))))
   {
      BrowserStatus=BROWSER_NOT_READY;
   }
   else
   {


      // Following DOES NOT WORK in case the result is XML !????? Any idea why ??

      // Page has been loaded, now extract the content of the file
      if(SUCCEEDED(HTMLDocument->QueryInterface(IID_IPersistFile,(LPVOID*)&PersistFile)))
      {
         // Save the file content to a temporary file
         PersistFile->Save(WideString(TempFile),false);
         PersistFile->Release();
      }


     // OR ... another approach ...
     // WHICH ALSO doesn't work :


     IHTMLElement *HTMLBody = NULL;

        if(SUCCEEDED(HTMLDocument->get_body(&HTMLBody)) && HTMLBody)
        {
            BSTR HTMLSource;
            if(HTMLBody && SUCCEEDED(HTMLBody->get_outerHTML(&HTMLSource)))
            {
                TMemo *Memo = new TMemo(BrowserParentForm) ;
                Memo->Text = WideString(HTMLSource);
                Memo->Lines->SaveToFile(TempFile) ;

 .....


Above code works great if the data is html for instance but if the result is XML then Getting the body or persistfile fails ?

Any ideas ???

Avatar of George Tokas
George Tokas
Flag of Greece image

I think that you need an XMLDocument component.
If you use BCB6 there is one under the internet tab. In Pro version I use there is one.
In BCB5 you have to add it manually as component.

gtokas.
Avatar of cybergonzo
cybergonzo

ASKER

Via another post (newsgroups) I have been advised to use NMHTML as component, which I'm checking out now.
It may not be (properly) doable with pCppWebBrowser anyway (?)
ASKER CERTIFIED SOLUTION
Avatar of George Tokas
George Tokas
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial