[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 802
  • Last Modified:

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 ???

0
cybergonzo
Asked:
cybergonzo
  • 2
1 Solution
 
George TokasCommented:
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.
0
 
cybergonzoAuthor Commented:
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 (?)
0
 
George TokasCommented:
TCppWebBrowser is a wrapper around internet explorer and communicates via OLE.
NMHTML is a component wrapper around HTML and tcp/ip. It supports POST. I think you can understand the difference. The document body you can display with TCppBrowser is stored at NMHTTP->Body property.
Both can work I think with what you want.

gtokas.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now