Solved

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

Posted on 2004-09-15
5
772 Views
Last Modified: 2013-11-17

  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
Comment
Question by:cybergonzo
  • 2
5 Comments
 
LVL 16

Expert Comment

by:George Tokas
Comment Utility
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
 

Author Comment

by:cybergonzo
Comment Utility
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
 
LVL 16

Accepted Solution

by:
George Tokas earned 250 total points
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now